-
}
+ spinning={true}
class={[
`${prefixCls}-image`,
- imgState.status === StatueEnum.LOADING ? '' : 'hidden',
+ {
+ hidden: imgState.status !== StatueEnum.LOADING,
+ },
]}
/>
) => {
+ if (!key) return '';
return t(getKey(key), ...arg);
},
};
diff --git a/src/layouts/default/content/index.less b/src/layouts/default/content/index.less
index 42bd51b6..6912f98d 100644
--- a/src/layouts/default/content/index.less
+++ b/src/layouts/default/content/index.less
@@ -14,10 +14,6 @@
position: absolute;
z-index: @page-loading-z-index;
- &.fill {
- background: rgba(240, 242, 245) !important;
- }
-
> .basic-loading {
margin-bottom: 15%;
}
diff --git a/src/layouts/default/content/index.tsx b/src/layouts/default/content/index.tsx
index 03544998..464e58f5 100644
--- a/src/layouts/default/content/index.tsx
+++ b/src/layouts/default/content/index.tsx
@@ -1,31 +1,25 @@
import './index.less';
-import { defineComponent, unref, computed } from 'vue';
-import { FullLoading } from '/@/components/Loading/index';
+import { defineComponent, unref } from 'vue';
+import { Loading } from '/@/components/Loading';
import { RouterView } from 'vue-router';
import { useRootSetting } from '/@/hooks/setting/useRootSetting';
import { useTransitionSetting } from '/@/hooks/setting/useTransitionSetting';
-import { useMultipleTabSetting } from '/@/hooks/setting/useMultipleTabSetting';
export default defineComponent({
name: 'LayoutContent',
setup() {
const { getOpenPageLoading } = useTransitionSetting();
- const { getShowMultipleTab } = useMultipleTabSetting();
const { getLayoutContentMode, getPageLoading } = useRootSetting();
- const getLoadingClass = computed(() => {
- return [
- `layout-content__loading`,
- { fill: unref(getShowMultipleTab), hidden: !unref(getPageLoading) },
- ];
- });
return () => {
return (
- {unref(getOpenPageLoading) && }
+ {unref(getOpenPageLoading) && (
+
+ )}
);
diff --git a/src/layouts/page/index.tsx b/src/layouts/page/index.tsx
index f94a02e5..24e8551f 100644
--- a/src/layouts/page/index.tsx
+++ b/src/layouts/page/index.tsx
@@ -22,6 +22,7 @@ export default defineComponent({
name: 'PageLayout',
setup() {
const { getShowMenu } = useMenuSetting();
+
const { getOpenKeepAlive, getCanEmbedIFramePage } = useRootSetting();
const { getBasicTransition, getEnableTransition } = useTransitionSetting();
diff --git a/src/locales/lang/en/routes/demo/comp.ts b/src/locales/lang/en/routes/demo/comp.ts
index 029d7287..4099ef12 100644
--- a/src/locales/lang/en/routes/demo/comp.ts
+++ b/src/locales/lang/en/routes/demo/comp.ts
@@ -24,4 +24,6 @@ export default {
qrcode: 'QR code',
strength: 'Password strength',
upload: 'Upload',
+
+ loading: 'Loading',
};
diff --git a/src/locales/lang/zh_CN/routes/demo/comp.ts b/src/locales/lang/zh_CN/routes/demo/comp.ts
index 13d8345a..cf49f6c4 100644
--- a/src/locales/lang/zh_CN/routes/demo/comp.ts
+++ b/src/locales/lang/zh_CN/routes/demo/comp.ts
@@ -24,4 +24,6 @@ export default {
qrcode: '二维码组件',
strength: '密码强度组件',
upload: '上传组件',
+
+ loading: 'Loading',
};
diff --git a/src/router/menus/modules/demo/comp.ts b/src/router/menus/modules/demo/comp.ts
index 81858a4f..6b467693 100644
--- a/src/router/menus/modules/demo/comp.ts
+++ b/src/router/menus/modules/demo/comp.ts
@@ -44,6 +44,10 @@ const menu: MenuModule = {
path: 'upload',
name: 'routes.demo.comp.upload',
},
+ {
+ path: 'loading',
+ name: 'routes.demo.comp.loading',
+ },
{
path: 'scroll',
name: 'routes.demo.comp.scroll',
diff --git a/src/router/routes/modules/demo/comp.ts b/src/router/routes/modules/demo/comp.ts
index 8cc0e577..b5dc6271 100644
--- a/src/router/routes/modules/demo/comp.ts
+++ b/src/router/routes/modules/demo/comp.ts
@@ -178,6 +178,14 @@ const comp: AppRouteModule = {
title: 'routes.demo.comp.upload',
},
},
+ {
+ path: '/loading',
+ name: 'LoadingDemo',
+ component: () => import('/@/views/demo/comp/loading/index.vue'),
+ meta: {
+ title: 'routes.demo.comp.loading',
+ },
+ },
],
};
diff --git a/src/setup/ant-design-vue/index.ts b/src/setup/ant-design-vue/index.ts
index 15ee4a64..d16f7cc8 100644
--- a/src/setup/ant-design-vue/index.ts
+++ b/src/setup/ant-design-vue/index.ts
@@ -12,8 +12,6 @@ import {
} from 'ant-design-vue';
import 'ant-design-vue/dist/antd.css';
-import './spin';
-
export function setupAntd(app: App
) {
// need
// Here are the components required before registering and logging in
diff --git a/src/setup/ant-design-vue/spin.tsx b/src/setup/ant-design-vue/spin.tsx
deleted file mode 100644
index 5cfae8b1..00000000
--- a/src/setup/ant-design-vue/spin.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import { Spin } from 'ant-design-vue';
-import svgImg from '/@/assets/images/loading.svg';
-
-Spin.setDefaultIndicator({
- indicator: () => {
- return (
-
-
-
- );
- },
-});
diff --git a/src/setup/directives/index.ts b/src/setup/directives/index.ts
index 34c86553..0329eb65 100644
--- a/src/setup/directives/index.ts
+++ b/src/setup/directives/index.ts
@@ -3,7 +3,9 @@
*/
import type { App } from 'vue';
import { setupPermissionDirective } from './permission';
+import { setupLoadingDirective } from './loading';
export function setupGlobDirectives(app: App) {
setupPermissionDirective(app);
+ setupLoadingDirective(app);
}
diff --git a/src/setup/directives/loading.ts b/src/setup/directives/loading.ts
new file mode 100644
index 00000000..20c6e445
--- /dev/null
+++ b/src/setup/directives/loading.ts
@@ -0,0 +1,43 @@
+import { createLoading } from '/@/components/Loading';
+import type { Directive, App } from 'vue';
+
+const loadingDirective: Directive = {
+ mounted(el, binding) {
+ const tip = el.getAttribute('loading-tip');
+ const background = el.getAttribute('loading-background');
+ const theme = el.getAttribute('loading-theme');
+ const size = el.getAttribute('loading-size');
+ const fullscreen = !!binding.modifiers.fullscreen;
+ const instance = createLoading(
+ {
+ tip,
+ background,
+ theme,
+ size: size || 'large',
+ loading: !!binding.value,
+ absolute: !fullscreen,
+ },
+ fullscreen ? document.body : el
+ );
+ el.instance = instance;
+ },
+ updated(el, binding) {
+ const instance = el.instance;
+ if (!instance) return;
+ instance.setTip(el.getAttribute('loading-tip'));
+ if (binding.oldValue !== binding.value) {
+ if (binding.oldValue !== binding.value) {
+ instance.setLoading?.(binding.value && !instance.loading);
+ }
+ }
+ },
+ unmounted(el) {
+ el?.instance?.close();
+ },
+};
+
+export function setupLoadingDirective(app: App) {
+ app.directive('loading', loadingDirective);
+}
+
+export default loadingDirective;
diff --git a/src/setup/i18n/index.ts b/src/setup/i18n/index.ts
index 90fb27f8..8d704b1f 100644
--- a/src/setup/i18n/index.ts
+++ b/src/setup/i18n/index.ts
@@ -15,7 +15,8 @@ const localeData: I18nOptions = {
messages: localeMessages,
availableLocales: availableLocales,
sync: true, //If you don’t want to inherit locale from global scope, you need to set sync of i18n component option to false.
- silentTranslationWarn: false, // true - warning off
+ silentTranslationWarn: true, // true - warning off
+ missingWarn: false,
silentFallbackWarn: true,
};
diff --git a/src/views/demo/comp/loading/index.vue b/src/views/demo/comp/loading/index.vue
new file mode 100644
index 00000000..7524cef6
--- /dev/null
+++ b/src/views/demo/comp/loading/index.vue
@@ -0,0 +1,96 @@
+
+
+
+
全屏 Loading
+
容器内 Loading
+
+
+
+
+
全屏 Loading
+
容器内 Loading
+
+
+
+ 打开指令Loading
+
+
+
+
diff --git a/tsconfig.json b/tsconfig.json
index 683297dc..d095229a 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,6 +1,6 @@
{
"compilerOptions": {
- "target": "esnext",
+ "target": "es2016",
"module": "esnext",
"moduleResolution": "node",
"strict": true,
diff --git a/vite.config.ts b/vite.config.ts
index 781ecc77..67d1ddc2 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -8,7 +8,7 @@ import { createProxy } from './build/vite/proxy';
import globbyTransform from './build/vite/plugin/transform/globby';
import dynamicImportTransform from './build/vite/plugin/transform/dynamic-import';
-import { isDevFn, loadEnv } from './build/utils';
+import { loadEnv } from './build/utils';
import { createRollupPlugin, createVitePlugins } from './build/vite/plugin';
@@ -55,7 +55,7 @@ const viteConfig: UserConfig = {
* Available options are 'terser' or 'esbuild'.
* @default 'terser'
*/
- minify: isDevFn() ? false : 'terser',
+ minify: 'terser',
/**
* Base public path when served in production.
* @default '/'
diff --git a/yarn.lock b/yarn.lock
index 05b4873d..896fb405 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -25,13 +25,14 @@
integrity sha512-Fi03PfuUqRs76aI3UWYpP864lkrfPo0hluwGqh7NJdLhvH4iRDc3jbJqZIvRDLHKbXrvAfPPV3+zjUccfFvWOQ==
"@ant-design/icons-vue@^5.1.6":
- version "5.1.6"
- resolved "https://registry.npmjs.org/@ant-design/icons-vue/-/icons-vue-5.1.6.tgz#af15cbf2375d95199e90166adce4c9f6ad1c17f1"
- integrity sha512-1KY04c/0iDM88ICdu6EW2/ZPOrH+FyL0uvR350XnVqvnDiLijdcrRaLzkZgCdBcy7cy5t5+onXKocymndCOdRA==
+ version "5.1.7"
+ resolved "https://registry.npmjs.org/@ant-design/icons-vue/-/icons-vue-5.1.7.tgz#5f8e26b547c3ecc16c0820152b935e8a44b5fad3"
+ integrity sha512-6UN/FydLs/bHC0WZxgSpdk0Ct8Ejzr7gdOx5sAIULpSprkxoHWiUbzTy8BMmUduImL42YY1L/qtZYJD6pIzmcQ==
dependencies:
"@ant-design/colors" "^5.0.0"
"@ant-design/icons-svg" "^4.0.0"
"@babel/runtime" "^7.10.4"
+ "@types/lodash" "^4.14.165"
lodash "^4.17.15"
"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.5.5", "@babel/code-frame@^7.8.3":
@@ -1420,7 +1421,7 @@
dependencies:
"@types/lodash" "*"
-"@types/lodash@*":
+"@types/lodash@*", "@types/lodash@^4.14.165":
version "4.14.165"
resolved "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.165.tgz#74d55d947452e2de0742bad65270433b63a8c30f"
integrity sha512-tjSSOTHhI5mCHTy/OOXYIhi2Wt1qcbHmuXD1Ha7q70CgI/I71afO4XtLb/cVexki1oVYchpul/TOuu3Arcdxrg==
@@ -1959,7 +1960,7 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0:
dependencies:
color-convert "^2.0.1"
-ant-design-vue@2.0.0-rc.2:
+ant-design-vue@^2.0.0-rc.2:
version "2.0.0-rc.2"
resolved "https://registry.npmjs.org/ant-design-vue/-/ant-design-vue-2.0.0-rc.2.tgz#fd3b4a5a64fccbb53ed488a194317a040de2223e"
integrity sha512-XA7X/7HHIveiTh41bZWGfoQ2Rys/rqWknK2zzdHwVnfw9ST3v+ciMKH0Uegyn7m14QL/EdUkC8zGsXpiSXqKNQ==