perf: view page add name

This commit is contained in:
xiaoxian521
2021-08-29 10:53:56 +08:00
parent 8187dbff0e
commit 47969f4349
17 changed files with 70 additions and 35 deletions

View File

@@ -1,11 +1,11 @@
import defaultSettings from "../../settings";
import { defineStore } from "pinia";
import { store } from "/@/store";
import defaultSettings from "../../settings"
import { defineStore } from "pinia"
import { store } from "/@/store"
interface SettingState {
title: string;
fixedHeader: boolean;
cachedPageList: string[];
title: string
fixedHeader: boolean
cachedPageList: string[]
}
export const useSettingStore = defineStore({
@@ -14,29 +14,29 @@ export const useSettingStore = defineStore({
title: defaultSettings.title,
fixedHeader: defaultSettings.fixedHeader,
// 需要开启keepalive的页面数组里面放页面的name即可
cachedPageList: ["editor"]
cachedPageList: ["welcome", "reEditor"]
}),
getters: {
getTitle() {
return this.title;
return this.title
},
getFixedHeader() {
return this.fixedHeader;
return this.fixedHeader
}
},
actions: {
CHANGE_SETTING({ key, value }) {
// eslint-disable-next-line no-prototype-builtins
if (this.hasOwnProperty(key)) {
this[key] = value;
this[key] = value
}
},
changeSetting(data) {
this.CHANGE_SETTING(data);
this.CHANGE_SETTING(data)
}
}
});
})
export function useSettingStoreHook() {
return useSettingStore(store);
return useSettingStore(store)
}