fix: 混合侧栏一键进入子页并开启路由进度条,消除首次点菜单无反馈

This commit is contained in:
2026-09-23 10:56:57 +08:00
parent 5b15c01606
commit 8b035ebca5
2 changed files with 7 additions and 3 deletions
+4 -1
View File
@@ -23,6 +23,8 @@ export const overridesPreferences = defineOverridesPreferences({
sidebar: {
collapsed: true,
expandOnHover: false,
// 混合侧栏:点击一级菜单直接进入默认子页,避免「点了没跳转、要再点一次」
autoActivateChild: true,
},
navigation: {
accordion: false, // 关闭手风琴模式,允许多个菜单同时展开
@@ -34,7 +36,8 @@ export const overridesPreferences = defineOverridesPreferences({
transition: {
enable: false,
loading: false,
progress: false,
// 首次点菜单要拉异步路由 chunk,开进度条避免「没反应」的错觉
progress: true,
},
logo: {
source: '/cd-logo.png',
@@ -10,7 +10,7 @@ import type {
import { markRaw, reactive, readonly, watch } from 'vue';
import { StorageManager } from '@vben-core/shared/cache';
import { MemoryStorageDriver, StorageManager } from '@vben-core/shared/cache';
import { isMacOs, merge } from '@vben-core/shared/utils';
import {
@@ -40,7 +40,8 @@ class PreferenceManager {
private state: Preferences;
constructor() {
this.cache = new StorageManager();
// 初始化完成前不用 LocalStorage,避免空 prefix 警告与误清全站存储
this.cache = new StorageManager({ driver: new MemoryStorageDriver() });
// 构造函数不再同步读取缓存,使用默认值初始化
// 真正的缓存加载在 initPreferences 中完成(已经是 async)
this.state = reactive<Preferences>({ ...defaultPreferences });