perf: 优化系统设置加载时机

This commit is contained in:
xiaojunnuo
2024-10-12 14:59:12 +08:00
parent 38be8d84b2
commit 73962536d5
16 changed files with 171 additions and 185 deletions
@@ -7,6 +7,8 @@ import { site } from "../utils/util.site";
import { routes } from "./resolve";
import { useResourceStore } from "../store/modules/resource";
import { useUserStore } from "../store/modules/user";
import { useSettingStore } from "/@/store/modules/settings";
const router = createRouter({
history: createWebHashHistory(),
routes
@@ -18,6 +20,8 @@ const router = createRouter({
router.beforeEach(async (to, from, next) => {
// 进度条
NProgress.start();
const settingStore = useSettingStore();
await settingStore.initOnce();
// 修复三级以上路由页面无法缓存的问题
if (to.matched && to.matched.length > 2) {
to.matched.splice(1, to.matched.length - 2);