fix(store): 分开存储

This commit is contained in:
BTMuli
2023-03-29 20:49:59 +08:00
parent e47c339a1b
commit 8f33bc2273

View File

@@ -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;