mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-27 14:31:41 +08:00
perf: refoctor useTitle
This commit is contained in:
@@ -3,7 +3,6 @@ import router from '/@/router';
|
||||
import { createProgressGuard } from './progressGuard';
|
||||
import { createPermissionGuard } from './permissionGuard';
|
||||
import { createPageLoadingGuard } from './pageLoadingGuard';
|
||||
import { createTitleGuard } from './titleGuard';
|
||||
import { createMessageGuard } from './messageGuard';
|
||||
import { createScrollGuard } from './scrollGuard';
|
||||
import { createHttpGuard } from './httpGuard';
|
||||
@@ -15,7 +14,6 @@ createPageLoadingGuard(router);
|
||||
createHttpGuard(router);
|
||||
createScrollGuard(router);
|
||||
createMessageGuard(router);
|
||||
createTitleGuard(router);
|
||||
createProgressGuard(router);
|
||||
createPermissionGuard(router);
|
||||
createStateGuard(router);
|
||||
|
@@ -1,18 +0,0 @@
|
||||
import type { Router } from 'vue-router';
|
||||
|
||||
import { useGlobSetting } from '/@/hooks/setting';
|
||||
|
||||
import { setTitle } from '/@/utils';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
|
||||
import { REDIRECT_NAME } from '/@/router/constant';
|
||||
|
||||
const globSetting = useGlobSetting();
|
||||
|
||||
export function createTitleGuard(router: Router) {
|
||||
router.afterEach(async (to) => {
|
||||
const { t } = useI18n();
|
||||
to.name !== REDIRECT_NAME && setTitle(t(to.meta.title as string), globSetting.title);
|
||||
return true;
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user