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