未验证 提交 74ded8ae 编写于 作者: L LooSheng 提交者: GitHub

perf: respect the writing style of pinia getters (#2645)

上级 d620758c
......@@ -36,19 +36,19 @@ export const useAppStore = defineStore({
beforeMiniInfo: {},
}),
getters: {
getPageLoading(): boolean {
return this.pageLoading;
getPageLoading(state): boolean {
return state.pageLoading;
},
getDarkMode(): 'light' | 'dark' | string {
return this.darkMode || localStorage.getItem(APP_DARK_MODE_KEY_) || darkMode;
getDarkMode(state): 'light' | 'dark' | string {
return state.darkMode || localStorage.getItem(APP_DARK_MODE_KEY_) || darkMode;
},
getBeforeMiniInfo(): BeforeMiniState {
return this.beforeMiniInfo;
getBeforeMiniInfo(state): BeforeMiniState {
return state.beforeMiniInfo;
},
getProjectConfig(): ProjectConfig {
return this.projectConfig || ({} as ProjectConfig);
getProjectConfig(state): ProjectConfig {
return state.projectConfig || ({} as ProjectConfig);
},
getHeaderSetting(): HeaderSetting {
......
......@@ -20,11 +20,11 @@ export const useErrorLogStore = defineStore({
errorLogListCount: 0,
}),
getters: {
getErrorLogInfoList(): ErrorLogInfo[] {
return this.errorLogInfoList || [];
getErrorLogInfoList(state): ErrorLogInfo[] {
return state.errorLogInfoList || [];
},
getErrorLogListCount(): number {
return this.errorLogListCount;
getErrorLogListCount(state): number {
return state.errorLogListCount;
},
},
actions: {
......
......@@ -21,11 +21,11 @@ export const useLocaleStore = defineStore({
localInfo: lsLocaleSetting,
}),
getters: {
getShowPicker(): boolean {
return !!this.localInfo?.showPicker;
getShowPicker(state): boolean {
return !!state.localInfo?.showPicker;
},
getLocale(): LocaleType {
return this.localInfo?.locale ?? 'zh_CN';
getLocale(state): LocaleType {
return state.localInfo?.locale ?? 'zh_CN';
},
},
actions: {
......
......@@ -16,8 +16,8 @@ export const useLockStore = defineStore({
lockInfo: Persistent.getLocal(LOCK_INFO_KEY),
}),
getters: {
getLockInfo(): Nullable<LockInfo> {
return this.lockInfo;
getLockInfo(state): Nullable<LockInfo> {
return state.lockInfo;
},
},
actions: {
......
......@@ -48,14 +48,14 @@ export const useMultipleTabStore = defineStore({
lastDragEndIndex: 0,
}),
getters: {
getTabList(): RouteLocationNormalized[] {
return this.tabList;
getTabList(state): RouteLocationNormalized[] {
return state.tabList;
},
getCachedTabList(): string[] {
return Array.from(this.cacheTabList);
getCachedTabList(state): string[] {
return Array.from(state.cacheTabList);
},
getLastDragEndIndex(): number {
return this.lastDragEndIndex;
getLastDragEndIndex(state): number {
return state.lastDragEndIndex;
},
},
actions: {
......
......@@ -60,20 +60,20 @@ export const usePermissionStore = defineStore({
frontMenuList: [],
}),
getters: {
getPermCodeList(): string[] | number[] {
return this.permCodeList;
getPermCodeList(state): string[] | number[] {
return state.permCodeList;
},
getBackMenuList(): Menu[] {
return this.backMenuList;
getBackMenuList(state): Menu[] {
return state.backMenuList;
},
getFrontMenuList(): Menu[] {
return this.frontMenuList;
getFrontMenuList(state): Menu[] {
return state.frontMenuList;
},
getLastBuildMenuTime(): number {
return this.lastBuildMenuTime;
getLastBuildMenuTime(state): number {
return state.lastBuildMenuTime;
},
getIsDynamicAddedRoute(): boolean {
return this.isDynamicAddedRoute;
getIsDynamicAddedRoute(state): boolean {
return state.isDynamicAddedRoute;
},
},
actions: {
......
......@@ -40,20 +40,20 @@ export const useUserStore = defineStore({
lastUpdateTime: 0,
}),
getters: {
getUserInfo(): UserInfo {
return this.userInfo || getAuthCache<UserInfo>(USER_INFO_KEY) || {};
getUserInfo(state): UserInfo {
return state.userInfo || getAuthCache<UserInfo>(USER_INFO_KEY) || {};
},
getToken(): string {
return this.token || getAuthCache<string>(TOKEN_KEY);
getToken(state): string {
return state.token || getAuthCache<string>(TOKEN_KEY);
},
getRoleList(): RoleEnum[] {
return this.roleList.length > 0 ? this.roleList : getAuthCache<RoleEnum[]>(ROLES_KEY);
getRoleList(state): RoleEnum[] {
return state.roleList.length > 0 ? state.roleList : getAuthCache<RoleEnum[]>(ROLES_KEY);
},
getSessionTimeout(): boolean {
return !!this.sessionTimeout;
getSessionTimeout(state): boolean {
return !!state.sessionTimeout;
},
getLastUpdateTime(): number {
return this.lastUpdateTime;
getLastUpdateTime(state): number {
return state.lastUpdateTime;
},
},
actions: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册