fix: 新增组件

This commit is contained in:
mtruning
2022-01-15 14:56:48 +08:00
parent f6860c3fa6
commit 3758db4cb6
25 changed files with 112 additions and 47 deletions
+7
View File
@@ -0,0 +1,7 @@
export enum SettingStoreEnums {
HIDE_PACKAGE_ONE_CATEGORY = 'hidePackageOneCategory',
}
export interface SettingStoreType {
[SettingStoreEnums.HIDE_PACKAGE_ONE_CATEGORY]: boolean
}
@@ -0,0 +1,28 @@
import { defineStore } from 'pinia'
import { hidePackageOneCategory } from '@/settings/systemSetting'
import { SettingStoreType } from './settingStore.d'
import { setLocalStorage, getLocalStorage } from '@/utils'
import { StorageEnum } from '@/enums/storageEnum'
const { GO_SYSTEM_SETTING } = StorageEnum
const storageSetting: SettingStoreType = getLocalStorage(GO_SYSTEM_SETTING)
// 全局设置
export const useSettingStore = defineStore({
id: 'useSettingStore',
state: (): SettingStoreType =>
storageSetting || {
hidePackageOneCategory,
},
getters: {
getHidePackageOneCategory(): boolean {
return this.hidePackageOneCategory
},
},
actions: {
setItem(key: string, value: boolean): void {
;(this as any)[key] = value
setLocalStorage(GO_SYSTEM_SETTING, this.$state)
},
},
})