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
}),
getters: {
getSidebarStatus() {
return this.sidebar.opened;
getSidebarStatus(state) {
return state.sidebar.opened;
},
getDevice() {
return this.device;
getDevice(state) {
return state.device;
}
},
actions: {

View File

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

View File

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

View File

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