feat: 新增图层展示类型持久化存储

This commit is contained in:
奔跑的面条
2022-10-01 21:10:06 +08:00
parent 87440362ac
commit 28668f2acb
8 changed files with 43 additions and 24 deletions
@@ -1,7 +1,13 @@
export enum LayerModeEnum {
THUMBNAIL = 'thumbnail',
TEXT = 'text'
}
export enum ChartLayoutStoreEnum {
LAYERS = 'layers',
CHARTS = 'charts',
DETAILS = 'details',
LAYER_TYPE = 'layerType'
}
export interface ChartLayoutType {
@@ -11,4 +17,6 @@ export interface ChartLayoutType {
[ChartLayoutStoreEnum.CHARTS]: boolean
// 详情设置
[ChartLayoutStoreEnum.DETAILS]: boolean
// 层级展示方式
[ChartLayoutStoreEnum.LAYER_TYPE]: LayerModeEnum
}
@@ -1,5 +1,5 @@
import { defineStore } from 'pinia'
import { ChartLayoutType } from './chartLayoutStore.d'
import { ChartLayoutType, LayerModeEnum } from './chartLayoutStore.d'
import { setLocalStorage, getLocalStorage } from '@/utils'
import { StorageEnum } from '@/enums/storageEnum'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
@@ -20,7 +20,9 @@ export const useChartLayoutStore = defineStore({
// 图表组件
charts: true,
// 详情设置(收缩为true
details: false
details: false,
// 图层类型(默认图片)
layerType: LayerModeEnum.THUMBNAIL
},
getters: {
getLayers(): boolean {
@@ -31,6 +33,9 @@ export const useChartLayoutStore = defineStore({
},
getDetails(): boolean {
return this.details
},
getLayerType(): LayerModeEnum {
return this.layerType
}
},
actions: {