From ed0a5e1a7d7031a61a0b75f51f24d6da0ca0cab3 Mon Sep 17 00:00:00 2001 From: lilinyuan <1084668738@qq.com> Date: Sun, 31 Mar 2024 00:23:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=90=8C=E6=AD=A5=E9=80=80=E5=87=BA?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=90=8E=E5=86=8D=E7=99=BB=E5=BD=95=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=E6=9D=83=E9=99=90=E8=B4=A6=E5=8F=B7=E6=97=B6=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E4=B8=8D=E6=9B=B4=E6=96=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/navbar/index.vue | 3 +++ src/stores/permisstion.js | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/layout/navbar/index.vue b/src/layout/navbar/index.vue index fb51821..edb258e 100644 --- a/src/layout/navbar/index.vue +++ b/src/layout/navbar/index.vue @@ -27,8 +27,10 @@ import Hamburger from './Hamburger.vue'; import {useAuthStore} from '@/stores/userstore.js' import BellSocket from "./BellSocket.vue"; import {getUserInfo} from "../../api/login"; +import {usePermisstionStroe} from '@/stores/permisstion' const authStore = useAuthStore() +const permisstionStore = usePermisstionStroe() const userInfo = ref({}) const visitedP = ref(false) const router = useRouter() @@ -58,6 +60,7 @@ const handleToAuth = () => { const handleLogout = () => { visitedP.value = !visitedP.value authStore.userLogout() + permisstionStore.removeMenu() router.push('/login') } diff --git a/src/stores/permisstion.js b/src/stores/permisstion.js index ddf9255..3744eb0 100644 --- a/src/stores/permisstion.js +++ b/src/stores/permisstion.js @@ -96,12 +96,18 @@ export const usePermisstionStroe = defineStore('permisstion', () => { } } + const removeMenu = () => { + menuList.value.length = 0 + asyncRouters.value.length = 0 + } + return { asyncRouters, menuList, isLoadRoutes, setAsyncRouters, - setIsLoadRoutes + setIsLoadRoutes, + removeMenu } }) \ No newline at end of file