perf: respect the writing style of pinia getters (#2645)
This commit is contained in:
parent
d620758c2f
commit
74ded8aed7
|
|
@ -36,19 +36,19 @@ export const useAppStore = defineStore({
|
||||||
beforeMiniInfo: {},
|
beforeMiniInfo: {},
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
getPageLoading(): boolean {
|
getPageLoading(state): boolean {
|
||||||
return this.pageLoading;
|
return state.pageLoading;
|
||||||
},
|
},
|
||||||
getDarkMode(): 'light' | 'dark' | string {
|
getDarkMode(state): 'light' | 'dark' | string {
|
||||||
return this.darkMode || localStorage.getItem(APP_DARK_MODE_KEY_) || darkMode;
|
return state.darkMode || localStorage.getItem(APP_DARK_MODE_KEY_) || darkMode;
|
||||||
},
|
},
|
||||||
|
|
||||||
getBeforeMiniInfo(): BeforeMiniState {
|
getBeforeMiniInfo(state): BeforeMiniState {
|
||||||
return this.beforeMiniInfo;
|
return state.beforeMiniInfo;
|
||||||
},
|
},
|
||||||
|
|
||||||
getProjectConfig(): ProjectConfig {
|
getProjectConfig(state): ProjectConfig {
|
||||||
return this.projectConfig || ({} as ProjectConfig);
|
return state.projectConfig || ({} as ProjectConfig);
|
||||||
},
|
},
|
||||||
|
|
||||||
getHeaderSetting(): HeaderSetting {
|
getHeaderSetting(): HeaderSetting {
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,11 @@ export const useErrorLogStore = defineStore({
|
||||||
errorLogListCount: 0,
|
errorLogListCount: 0,
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
getErrorLogInfoList(): ErrorLogInfo[] {
|
getErrorLogInfoList(state): ErrorLogInfo[] {
|
||||||
return this.errorLogInfoList || [];
|
return state.errorLogInfoList || [];
|
||||||
},
|
},
|
||||||
getErrorLogListCount(): number {
|
getErrorLogListCount(state): number {
|
||||||
return this.errorLogListCount;
|
return state.errorLogListCount;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,11 @@ export const useLocaleStore = defineStore({
|
||||||
localInfo: lsLocaleSetting,
|
localInfo: lsLocaleSetting,
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
getShowPicker(): boolean {
|
getShowPicker(state): boolean {
|
||||||
return !!this.localInfo?.showPicker;
|
return !!state.localInfo?.showPicker;
|
||||||
},
|
},
|
||||||
getLocale(): LocaleType {
|
getLocale(state): LocaleType {
|
||||||
return this.localInfo?.locale ?? 'zh_CN';
|
return state.localInfo?.locale ?? 'zh_CN';
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ export const useLockStore = defineStore({
|
||||||
lockInfo: Persistent.getLocal(LOCK_INFO_KEY),
|
lockInfo: Persistent.getLocal(LOCK_INFO_KEY),
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
getLockInfo(): Nullable<LockInfo> {
|
getLockInfo(state): Nullable<LockInfo> {
|
||||||
return this.lockInfo;
|
return state.lockInfo;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
||||||
|
|
@ -48,14 +48,14 @@ export const useMultipleTabStore = defineStore({
|
||||||
lastDragEndIndex: 0,
|
lastDragEndIndex: 0,
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
getTabList(): RouteLocationNormalized[] {
|
getTabList(state): RouteLocationNormalized[] {
|
||||||
return this.tabList;
|
return state.tabList;
|
||||||
},
|
},
|
||||||
getCachedTabList(): string[] {
|
getCachedTabList(state): string[] {
|
||||||
return Array.from(this.cacheTabList);
|
return Array.from(state.cacheTabList);
|
||||||
},
|
},
|
||||||
getLastDragEndIndex(): number {
|
getLastDragEndIndex(state): number {
|
||||||
return this.lastDragEndIndex;
|
return state.lastDragEndIndex;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
||||||
|
|
@ -60,20 +60,20 @@ export const usePermissionStore = defineStore({
|
||||||
frontMenuList: [],
|
frontMenuList: [],
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
getPermCodeList(): string[] | number[] {
|
getPermCodeList(state): string[] | number[] {
|
||||||
return this.permCodeList;
|
return state.permCodeList;
|
||||||
},
|
},
|
||||||
getBackMenuList(): Menu[] {
|
getBackMenuList(state): Menu[] {
|
||||||
return this.backMenuList;
|
return state.backMenuList;
|
||||||
},
|
},
|
||||||
getFrontMenuList(): Menu[] {
|
getFrontMenuList(state): Menu[] {
|
||||||
return this.frontMenuList;
|
return state.frontMenuList;
|
||||||
},
|
},
|
||||||
getLastBuildMenuTime(): number {
|
getLastBuildMenuTime(state): number {
|
||||||
return this.lastBuildMenuTime;
|
return state.lastBuildMenuTime;
|
||||||
},
|
},
|
||||||
getIsDynamicAddedRoute(): boolean {
|
getIsDynamicAddedRoute(state): boolean {
|
||||||
return this.isDynamicAddedRoute;
|
return state.isDynamicAddedRoute;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
||||||
|
|
@ -40,20 +40,20 @@ export const useUserStore = defineStore({
|
||||||
lastUpdateTime: 0,
|
lastUpdateTime: 0,
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
getUserInfo(): UserInfo {
|
getUserInfo(state): UserInfo {
|
||||||
return this.userInfo || getAuthCache<UserInfo>(USER_INFO_KEY) || {};
|
return state.userInfo || getAuthCache<UserInfo>(USER_INFO_KEY) || {};
|
||||||
},
|
},
|
||||||
getToken(): string {
|
getToken(state): string {
|
||||||
return this.token || getAuthCache<string>(TOKEN_KEY);
|
return state.token || getAuthCache<string>(TOKEN_KEY);
|
||||||
},
|
},
|
||||||
getRoleList(): RoleEnum[] {
|
getRoleList(state): RoleEnum[] {
|
||||||
return this.roleList.length > 0 ? this.roleList : getAuthCache<RoleEnum[]>(ROLES_KEY);
|
return state.roleList.length > 0 ? state.roleList : getAuthCache<RoleEnum[]>(ROLES_KEY);
|
||||||
},
|
},
|
||||||
getSessionTimeout(): boolean {
|
getSessionTimeout(state): boolean {
|
||||||
return !!this.sessionTimeout;
|
return !!state.sessionTimeout;
|
||||||
},
|
},
|
||||||
getLastUpdateTime(): number {
|
getLastUpdateTime(state): number {
|
||||||
return this.lastUpdateTime;
|
return state.lastUpdateTime;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue