perf: pinia中所有getters改为官方推荐写法,this改成state可自动推导类型 (#490)

Co-authored-by: 苗大 <caoshengmiao@hypergryph.com>
This commit is contained in:
Wit〆苗大 2023-03-28 16:25:56 +08:00 committed by GitHub
parent 990caef48d
commit bff68c3e7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 17 deletions

View File

@ -23,11 +23,11 @@ export const useAppStore = defineStore({
sortSwap: false sortSwap: false
}), }),
getters: { getters: {
getSidebarStatus() { getSidebarStatus(state) {
return this.sidebar.opened; return state.sidebar.opened;
}, },
getDevice() { getDevice(state) {
return this.device; return state.device;
} }
}, },
actions: { actions: {

View File

@ -14,14 +14,14 @@ export const useEpThemeStore = defineStore({
getConfig().Theme getConfig().Theme
}), }),
getters: { getters: {
getEpThemeColor() { getEpThemeColor(state) {
return this.epThemeColor; return state.epThemeColor;
}, },
/** 用于mix导航模式下hamburger-svg的fill属性 */ /** 用于mix导航模式下hamburger-svg的fill属性 */
fill() { fill(state) {
if (this.epTheme === "light") { if (state.epTheme === "light") {
return "#409eff"; return "#409eff";
} else if (this.epTheme === "yellow") { } else if (state.epTheme === "yellow") {
return "#d25f00"; return "#d25f00";
} else { } else {
return "#fff"; return "#fff";

View File

@ -17,8 +17,8 @@ export const useMultiTagsStore = defineStore({
)?.multiTagsCache )?.multiTagsCache
}), }),
getters: { getters: {
getMultiTagsCache() { getMultiTagsCache(state) {
return this.multiTagsCache; return state.multiTagsCache;
} }
}, },
actions: { actions: {

View File

@ -11,14 +11,14 @@ export const useSettingStore = defineStore({
hiddenSideBar: getConfig().HiddenSideBar hiddenSideBar: getConfig().HiddenSideBar
}), }),
getters: { getters: {
getTitle() { getTitle(state) {
return this.title; return state.title;
}, },
getFixedHeader() { getFixedHeader(state) {
return this.fixedHeader; return state.fixedHeader;
}, },
getHiddenSideBar() { getHiddenSideBar(state) {
return this.HiddenSideBar; return state.hiddenSideBar;
} }
}, },
actions: { actions: {