From 8f33bc22739dd0e9e79e18e58b809e1190bef867 Mon Sep 17 00:00:00 2001 From: BTMuli Date: Wed, 29 Mar 2023 20:49:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(store):=20=E5=88=86=E5=BC=80=E5=AD=98?= =?UTF-8?q?=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/app.ts | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts index 7b4bbea0..83ac559b 100644 --- a/src/store/modules/app.ts +++ b/src/store/modules/app.ts @@ -30,8 +30,6 @@ const useAppStore = defineStore({ database: false, }, }, - // 咨讯页渲染模式 - structureRender: true, // 是否采用结构化渲染,否则采用 raw 渲染 // 开发者模式 devMode: false, // 数据路径 @@ -70,19 +68,15 @@ const useAppStore = defineStore({ }, // 初始化配置 async init() { - // 防止数据清空 - if (this.sidebar === undefined) { - this.sidebar = { - collapse: false, - submenu: { - database: false, - }, - }; - } + // 初始化侧边栏设置 + this.sidebar = { + collapse: false, + submenu: { + database: false, + }, + }; // 初始化加载状态 this.loading = false; - // 初始化咨讯页渲染模式 - this.structureRender = true; // 初始化开发者模式 this.devMode = false; // 初始化用户数据路径 @@ -97,7 +91,23 @@ const useAppStore = defineStore({ return open; }, }, - persist: true, + persist: [ + { + key: "appPath", + storage: window.localStorage, + paths: ["dataPath", "appPath", "userPath"], + }, + { + key: "app", + storage: window.localStorage, + paths: ["devMode", "loading"], + }, + { + key: "sidebar", + storage: window.localStorage, + paths: ["sidebar"], + }, + ], }); export default useAppStore;