feat: 统一获取app-routes方法

This commit is contained in:
rd
2025-07-25 11:52:23 +08:00
parent 2169df7082
commit 9bc6ed44d5
3 changed files with 8 additions and 10 deletions

View File

@ -1,9 +1,7 @@
import type { RouteRecordNormalized } from 'vue-router';
import { useRouter } from 'vue-router';
import { defineStore } from 'pinia';
import { fetchProfileInfo } from '@/api/all/login';
import { useSidebarStore } from '@/stores/modules/side-bar';
import router from '@/router';
import { glsWithCatch, slsWithCatch, rlsWithCatch } from '@/utils/stroage';
interface UserInfo {
@ -80,8 +78,10 @@ export const useUserStore = defineStore('user', {
},
getUserAllowAccessRoutes() {
const sidebarStore = useSidebarStore();
const router = useRouter();
const menuList = sidebarStore.menuList;
const appRoutes = router.getRoutes();
const appRoutes = router.options.routes;
appRoutes.forEach((route: any) => {
if (!route.meta?.requiresAuth) {