Skip to content

Commit

Permalink
feat(setting): add openNProgress setting
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Oct 7, 2020
1 parent faf3f46 commit 67d0ff0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vben-admin-2.0",
"version": "2.0.0-beta.2",
"version": "2.0.0-beta.3",
"scripts": {
"bootstrap": "yarn install",
"serve": "ts-node --project ./build/tsconfig.json ./build/script/preserve && cross-env NODE_ENV=development vite",
Expand Down
7 changes: 5 additions & 2 deletions src/router/guard/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ import { createPageTitleGuard } from './pageTitleGuard';
import { createProgressGuard } from './progressGuard';
import { createPermissionGuard } from './permissionGuard';
import { createPageLoadingGuard } from './pageLoadingGuard';
import { useSetting } from '/@/hooks/core/useSetting';

const axiosCanceler = new AxiosCanceler();
const { projectSetting } = useSetting();
export function createGuard(router: Router) {
const axiosCanceler = new AxiosCanceler();

router.beforeEach(async () => {
try {
Modal.destroyAll();
Expand All @@ -20,7 +23,7 @@ export function createGuard(router: Router) {
console.warn('basic guard error:' + error);
}
});
createProgressGuard(router);
projectSetting.openNProgress && createProgressGuard(router);
createPermissionGuard(router);
createPageTitleGuard(router);
createPageLoadingGuard(router);
Expand Down
3 changes: 3 additions & 0 deletions src/settings/projectSetting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ const setting: ProjectConfig = {
// 是否开启回到顶部
useOpenBackTop: true,

// 开启顶部进度条
openNProgress: isProdMode(),

// 是否可以嵌入iframe页面
canEmbedIFramePage: true,
};
Expand Down
2 changes: 2 additions & 0 deletions src/types/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ export interface ProjectConfig {
openPageLoading: boolean;
// 是否开启回到顶部
useOpenBackTop: boolean;
// 开启顶部进度条
openNProgress: boolean;
// 是否可以嵌入iframe页面
canEmbedIFramePage: boolean;
}
Expand Down

0 comments on commit 67d0ff0

Please sign in to comment.