fix: 解决点击图表分列没反应的bug

This commit is contained in:
奔跑的面条 2022-11-19 20:37:06 +08:00
parent a25f9bc5a1
commit 936d78975e

View File

@ -8,13 +8,12 @@ const chartEditStore = useChartEditStore()
const { GO_CHART_LAYOUT_STORE } = StorageEnum
const storageChartLayout: ChartLayoutType = getLocalStorage(GO_CHART_LAYOUT_STORE)
const storageChartLayout: Partial<ChartLayoutType> = getLocalStorage(GO_CHART_LAYOUT_STORE)
// 编辑区域布局和静态设置
export const useChartLayoutStore = defineStore({
id: 'useChartLayoutStore',
state: (): ChartLayoutType =>
storageChartLayout || {
state: (): ChartLayoutType => ({
// 图层控制
layers: true,
// 图表组件
@ -24,8 +23,10 @@ export const useChartLayoutStore = defineStore({
// 组件列表展示类型(默认单列)
chartType: ChartModeEnum.SINGLE,
// 图层类型(默认图片)
layerType: LayerModeEnum.THUMBNAIL
},
layerType: LayerModeEnum.THUMBNAIL,
// 防止值不存在
...storageChartLayout
}),
getters: {
getLayers(): boolean {
return this.layers
@ -46,8 +47,8 @@ export const useChartLayoutStore = defineStore({
actions: {
setItem<T extends keyof ChartLayoutType, K extends ChartLayoutType[T]>(key: T, value: K): void {
this.$patch(state => {
state[key]= value
});
state[key] = value
})
setLocalStorage(GO_CHART_LAYOUT_STORE, this.$state)
// 重新计算拖拽区域缩放比例
setTimeout(() => {