mirror of
https://github.com/jekip/naive-ui-admin.git
synced 2026-03-01 00:23:11 +08:00
feat(loadingBar): 增加加载条与主题颜色适配
This commit is contained in:
@@ -41,6 +41,9 @@
|
|||||||
primaryColor: designStore.appTheme,
|
primaryColor: designStore.appTheme,
|
||||||
primaryColorHover: '#57a3f3',
|
primaryColorHover: '#57a3f3',
|
||||||
},
|
},
|
||||||
|
LoadingBar: {
|
||||||
|
colorLoading: designStore.appTheme,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<n-loading-bar-provider>
|
<n-loading-bar-provider>
|
||||||
<LoadingContent />
|
|
||||||
<n-dialog-provider>
|
<n-dialog-provider>
|
||||||
<DialogContent />
|
<DialogContent />
|
||||||
<n-notification-provider>
|
<n-notification-provider>
|
||||||
@@ -21,7 +20,6 @@
|
|||||||
NMessageProvider,
|
NMessageProvider,
|
||||||
NLoadingBarProvider,
|
NLoadingBarProvider,
|
||||||
} from 'naive-ui';
|
} from 'naive-ui';
|
||||||
import { LoadingContent } from '@/components/LoadingContent';
|
|
||||||
import { MessageContent } from '@/components/MessageContent';
|
import { MessageContent } from '@/components/MessageContent';
|
||||||
import { DialogContent } from '@/components/DialogContent';
|
import { DialogContent } from '@/components/DialogContent';
|
||||||
|
|
||||||
@@ -32,7 +30,6 @@
|
|||||||
NNotificationProvider,
|
NNotificationProvider,
|
||||||
NMessageProvider,
|
NMessageProvider,
|
||||||
NLoadingBarProvider,
|
NLoadingBarProvider,
|
||||||
LoadingContent,
|
|
||||||
MessageContent,
|
MessageContent,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -65,6 +65,7 @@
|
|||||||
import { PageFooter } from './components/Footer';
|
import { PageFooter } from './components/Footer';
|
||||||
import { useProjectSetting } from '@/hooks/setting/useProjectSetting';
|
import { useProjectSetting } from '@/hooks/setting/useProjectSetting';
|
||||||
import { useDesignSetting } from '@/hooks/setting/useDesignSetting';
|
import { useDesignSetting } from '@/hooks/setting/useDesignSetting';
|
||||||
|
import { useLoadingBar } from "naive-ui";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'Layout',
|
name: 'Layout',
|
||||||
@@ -135,6 +136,8 @@
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
window.addEventListener('resize', watchWidth);
|
window.addEventListener('resize', watchWidth);
|
||||||
|
//挂载在 window 方便与在js中使用
|
||||||
|
window['$loading'] = useLoadingBar();
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ const whitePathList = [LOGIN_PATH]; // no redirect whitelist
|
|||||||
export function createRouterGuards(router: Router) {
|
export function createRouterGuards(router: Router) {
|
||||||
const userStore = useUserStoreWidthOut();
|
const userStore = useUserStoreWidthOut();
|
||||||
const asyncRouteStore = useAsyncRouteStoreWidthOut();
|
const asyncRouteStore = useAsyncRouteStoreWidthOut();
|
||||||
const Loading = window['$loading'] || null;
|
|
||||||
router.beforeEach(async (to, from, next) => {
|
router.beforeEach(async (to, from, next) => {
|
||||||
|
const Loading = window['$loading'] || null;
|
||||||
Loading && Loading.start();
|
Loading && Loading.start();
|
||||||
if (from.path === LOGIN_PATH && to.name === 'errorPage') {
|
if (from.path === LOGIN_PATH && to.name === 'errorPage') {
|
||||||
next(PageEnum.BASE_HOME);
|
next(PageEnum.BASE_HOME);
|
||||||
@@ -91,6 +91,7 @@ export function createRouterGuards(router: Router) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
asyncRouteStore.setKeepAliveComponents(keepAliveComponents);
|
asyncRouteStore.setKeepAliveComponents(keepAliveComponents);
|
||||||
|
const Loading = window['$loading'] || null;
|
||||||
Loading && Loading.finish();
|
Loading && Loading.finish();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -5123,11 +5123,6 @@ npm-run-path@^4.0.0, npm-run-path@^4.0.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
path-key "^3.0.0"
|
path-key "^3.0.0"
|
||||||
|
|
||||||
nprogress@^1.0.0-1:
|
|
||||||
version "1.0.0-1"
|
|
||||||
resolved "https://registry.npmjs.org/nprogress/-/nprogress-1.0.0-1.tgz#dd4cce2b951f9359028facd6c51cc9c49ecfa1a2"
|
|
||||||
integrity sha512-Gr/Km0nIMbR7hOB0fjGx7nR0oRjTy9M61dXiQL5bfTBq0cQ+hNgt6gxE062j7Bxm+L/IjNVOr41iu2hrDeuedw==
|
|
||||||
|
|
||||||
num2fraction@^1.2.2:
|
num2fraction@^1.2.2:
|
||||||
version "1.2.2"
|
version "1.2.2"
|
||||||
resolved "https://registry.npmjs.org/num2fraction/-/num2fraction-1.2.2.tgz#6f682b6a027a4e9ddfa4564cd2589d1d4e669ede"
|
resolved "https://registry.npmjs.org/num2fraction/-/num2fraction-1.2.2.tgz#6f682b6a027a4e9ddfa4564cd2589d1d4e669ede"
|
||||||
|
|||||||
Reference in New Issue
Block a user