fix: 处理打包警告,处理命名问题
This commit is contained in:
+6
-10
@@ -1,7 +1,8 @@
|
||||
import router from '@/router';
|
||||
import { auth } from '@/hooks/useAuth';
|
||||
import { useTabsStore } from '@/stores/tabsStore';
|
||||
import { useMenuStore } from '@/stores/menuStore';
|
||||
import { usePermissionStore } from '@/stores/permissionStore';
|
||||
import { useTabsStore } from '@/stores/tabsStore';
|
||||
|
||||
const appTitle = import.meta.env.VITE_APP_TITLE || 'CPMS 运营平台';
|
||||
|
||||
@@ -32,12 +33,9 @@ router.beforeEach(async (to, _from, next) => {
|
||||
// ── /login 特殊处理 ──
|
||||
if (to.path === '/login') {
|
||||
if (auth.isLoggedIn()) {
|
||||
const { loadMenu, loaded, homePath, isRoutePathAvailable } =
|
||||
await import('@/stores/menuStore').then((m) => m.useMenuStore());
|
||||
const { loadMenu, loaded, homePath, isRoutePathAvailable } = useMenuStore();
|
||||
if (!loaded.value) {
|
||||
const { loadPermissions } = await import('@/stores/permissionStore').then((m) =>
|
||||
m.usePermissionStore(),
|
||||
);
|
||||
const { loadPermissions } = usePermissionStore();
|
||||
await Promise.all([loadMenu(), loadPermissions()]);
|
||||
}
|
||||
|
||||
@@ -60,11 +58,9 @@ router.beforeEach(async (to, _from, next) => {
|
||||
}
|
||||
|
||||
// ── 已登录:确保菜单和动态路由已加载 ──
|
||||
const { loadMenu, loaded } = await import('@/stores/menuStore').then((m) => m.useMenuStore());
|
||||
const { loadMenu, loaded } = useMenuStore();
|
||||
if (!loaded.value) {
|
||||
const { loadPermissions } = await import('@/stores/permissionStore').then((m) =>
|
||||
m.usePermissionStore(),
|
||||
);
|
||||
const { loadPermissions } = usePermissionStore();
|
||||
await Promise.all([loadMenu(), loadPermissions()]);
|
||||
|
||||
// 动态路由刚注册,需要用新路由表重新匹配当前路径
|
||||
|
||||
Reference in New Issue
Block a user