From bff68c3e7b25976a8830ef95fbcded2103b84585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wit=E3=80=86=E8=8B=97=E5=A4=A7?= Date: Tue, 28 Mar 2023 16:25:56 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20`pinia`=E4=B8=AD=E6=89=80=E6=9C=89`gett?= =?UTF-8?q?ers`=E6=94=B9=E4=B8=BA=E5=AE=98=E6=96=B9=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E5=86=99=E6=B3=95=EF=BC=8C`this`=E6=94=B9=E6=88=90`state`?= =?UTF-8?q?=E5=8F=AF=E8=87=AA=E5=8A=A8=E6=8E=A8=E5=AF=BC=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=20(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 苗大 --- src/store/modules/app.ts | 8 ++++---- src/store/modules/epTheme.ts | 10 +++++----- src/store/modules/multiTags.ts | 4 ++-- src/store/modules/settings.ts | 12 ++++++------ 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts index 38919b780..d9de982b4 100644 --- a/src/store/modules/app.ts +++ b/src/store/modules/app.ts @@ -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: { diff --git a/src/store/modules/epTheme.ts b/src/store/modules/epTheme.ts index 77f582cd2..956148745 100644 --- a/src/store/modules/epTheme.ts +++ b/src/store/modules/epTheme.ts @@ -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"; diff --git a/src/store/modules/multiTags.ts b/src/store/modules/multiTags.ts index 70f9f1f95..fbbd9b5b2 100644 --- a/src/store/modules/multiTags.ts +++ b/src/store/modules/multiTags.ts @@ -17,8 +17,8 @@ export const useMultiTagsStore = defineStore({ )?.multiTagsCache }), getters: { - getMultiTagsCache() { - return this.multiTagsCache; + getMultiTagsCache(state) { + return state.multiTagsCache; } }, actions: { diff --git a/src/store/modules/settings.ts b/src/store/modules/settings.ts index 3cb6c3459..60a45ea73 100644 --- a/src/store/modules/settings.ts +++ b/src/store/modules/settings.ts @@ -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: {