From a1d743aa746ae62f471456849c31df4dd1cddd7a Mon Sep 17 00:00:00 2001 From: MTrun <1262327911@qq.com> Date: Wed, 5 Jan 2022 21:05:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=96=B0=E5=A2=9E=20store=20=E6=8E=A7?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chartLayoutStore/chartLayoutStore.d.ts | 13 +++-- .../chartLayoutStore/chartLayoutStore.ts | 52 +++++++++++++++++++ src/store/types.ts | 2 + src/views/chart/index.vue | 4 +- 4 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 src/store/modules/chartLayoutStore/chartLayoutStore.ts diff --git a/src/store/modules/chartLayoutStore/chartLayoutStore.d.ts b/src/store/modules/chartLayoutStore/chartLayoutStore.d.ts index b6f553cd..0e28b64f 100644 --- a/src/store/modules/chartLayoutStore/chartLayoutStore.d.ts +++ b/src/store/modules/chartLayoutStore/chartLayoutStore.d.ts @@ -2,19 +2,24 @@ import { ThemeEnum } from '@/enums/styleEnum' export interface ChartLayoutType { // 图层控制 - layers: true, + layers: boolean, // 图表组件 - charts: true, + charts: boolean, // 详情设置 - details: true, + details: boolean, // 对齐线 - alignLine: true, + alignLine: boolean, // 滤镜 filter: { // 色相 + hueRotate: number, // 饱和度 + saturate: number, // 亮度 + brightness: number, // 对比度 + contrast: number, // 不透明度 + unOpacity: number } } diff --git a/src/store/modules/chartLayoutStore/chartLayoutStore.ts b/src/store/modules/chartLayoutStore/chartLayoutStore.ts new file mode 100644 index 00000000..130dfd30 --- /dev/null +++ b/src/store/modules/chartLayoutStore/chartLayoutStore.ts @@ -0,0 +1,52 @@ +import { defineStore } from 'pinia' +import { store } from '@/store' +import { ChartLayoutType } from './chartLayoutStore.d' + +export const useChartLayoutStore = defineStore({ + id: 'useChartLayoutStore', + state: (): ChartLayoutType => ({ + // 图层控制 + layers: true, + // 图表组件 + charts: true, + // 详情设置 + details: true, + // 对齐线 + alignLine: true, + // 滤镜 + filter: { + // 色相 + hueRotate: 0, + // 饱和度 + saturate: 0, + // 亮度 + brightness: 100, + // 对比度 + contrast: 100, + // 不透明度 + unOpacity: 100 + } + }), + getters: { + getLayers(e): boolean { + return this.layers + }, + getCharts(): boolean { + return this.charts + }, + getDetails(): boolean { + return this.details + }, + getAlignLine(): boolean { + return this.alignLine + }, + getFilter(): object { + return this.filter + } + } +}) + + +export function useChartLayoutSettingWithOut() { + return useChartLayoutStore(store) +} \ No newline at end of file diff --git a/src/store/types.ts b/src/store/types.ts index bc8f814b..1a38eb23 100644 --- a/src/store/types.ts +++ b/src/store/types.ts @@ -1,7 +1,9 @@ import { DesignStateType } from '@/store/modules/designStore/designStore.d'; import { LangStateType } from '@/store/modules/langStore/langStore.d'; +import { ChartLayoutType } from '@/store/modules/chartLayoutStore/chartLayoutStore.d'; export interface allStore { useDesignStore: DesignStateType; useLangStore: LangStateType; + useChartLayoutStore: ChartLayoutType; } diff --git a/src/views/chart/index.vue b/src/views/chart/index.vue index 37a720bc..e4eb150b 100644 --- a/src/views/chart/index.vue +++ b/src/views/chart/index.vue @@ -12,7 +12,9 @@ - + + +