diff --git a/src/store/modules/menu.ts b/src/store/modules/menu.ts index c9462fe6..26c69941 100644 --- a/src/store/modules/menu.ts +++ b/src/store/modules/menu.ts @@ -99,11 +99,15 @@ const useMenuStore = defineStore( let isAuth = false if (menu.meta && menu.meta.auth) { isAuth = permissions.some((auth) => { - return typeof menu.meta?.auth === 'string' - ? menu.meta.auth === auth - : typeof menu.meta?.auth === 'object' - ? menu.meta.auth.includes(auth) - : false + if (typeof menu.meta?.auth === 'string') { + return menu.meta.auth !== '' ? menu.meta.auth === auth : true + } + else if (typeof menu.meta?.auth === 'object') { + return menu.meta.auth.length > 0 ? menu.meta.auth.includes(auth) : true + } + else { + return false + } }) } else { diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 9f133ede..23d282fd 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -111,11 +111,15 @@ const useRouteStore = defineStore( let isAuth = false if (route.meta?.auth) { isAuth = permissions.some((auth) => { - return typeof route.meta?.auth === 'string' - ? route.meta.auth === auth - : typeof route.meta?.auth === 'object' - ? route.meta.auth.includes(auth) - : false + if (typeof route.meta?.auth === 'string') { + return route.meta.auth !== '' ? route.meta.auth === auth : true + } + else if (typeof route.meta?.auth === 'object') { + return route.meta.auth.length > 0 ? route.meta.auth.includes(auth) : true + } + else { + return false + } }) } else {