From 4911affd28ffb971f657fefa99afe31d18f7488d Mon Sep 17 00:00:00 2001 From: Hooray Hu <304327508@qq.com> Date: Tue, 9 Apr 2024 15:14:00 +0800 Subject: [PATCH] =?UTF-8?q?refactor!:=20=E8=B7=AF=E7=94=B1=20`meta.auth`?= =?UTF-8?q?=20=E4=BF=9D=E6=8C=81=E5=85=83=E4=BF=A1=E6=81=AF=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=90=88=E5=B9=B6=E8=A1=8C=E4=B8=BA=EF=BC=8C=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E8=AE=BF=E9=97=AE=E6=94=B9=E4=B8=BA=E9=80=9A=E8=BF=87?= =?UTF-8?q?=20`route.matched`=20=E8=BF=9B=E8=A1=8C=E9=80=90=E7=BA=A7?= =?UTF-8?q?=E9=89=B4=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 12 ++++++++++-- src/store/modules/route.ts | 11 ++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/App.vue b/src/App.vue index 9f46e350..01efc353 100755 --- a/src/App.vue +++ b/src/App.vue @@ -6,9 +6,17 @@ import eventBus from './utils/eventBus' import Provider from './ui-provider/index.vue' import useSettingsStore from '@/store/modules/settings' +const route = useRoute() + const settingsStore = useSettingsStore() const { auth } = useAuth() +const isAuth = computed(() => { + return route.matched.every((item) => { + return auth(item.meta.auth ?? '') + }) +}) + // 侧边栏主导航当前实际宽度 const mainSidebarActualWidth = computed(() => { let actualWidth = Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--g-main-sidebar-width')) @@ -61,13 +69,13 @@ import.meta.env.VITE_APP_DEBUG_TOOL === 'vconsole' && new VConsole()