mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
fix: 新增组件
This commit is contained in:
@@ -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)
|
||||
},
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user