mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
featr: 新增图层选中的样式
This commit is contained in:
+7
-6
@@ -44,11 +44,12 @@ export type MousePositionType = {
|
||||
|
||||
// 操作目标
|
||||
export type TargetChartType = {
|
||||
index: number
|
||||
hoverIndex?: string
|
||||
selectIndex?: string
|
||||
}
|
||||
|
||||
// Store 类型
|
||||
export enum chartEditStoreEnum {
|
||||
export enum ChartEditStoreEnum {
|
||||
EDITCANVAS = 'editCanvas',
|
||||
MOUSEPOSITION = 'mousePosition',
|
||||
COMPONENT_LIST = 'componentList',
|
||||
@@ -56,8 +57,8 @@ export enum chartEditStoreEnum {
|
||||
}
|
||||
|
||||
export interface chartEditStoreType {
|
||||
[chartEditStoreEnum.EDITCANVAS]: EditCanvasType
|
||||
[chartEditStoreEnum.MOUSEPOSITION]: MousePositionType
|
||||
[chartEditStoreEnum.TARGET_CHART]: TargetChartType
|
||||
[chartEditStoreEnum.COMPONENT_LIST]: any[]
|
||||
[ChartEditStoreEnum.EDITCANVAS]: EditCanvasType
|
||||
[ChartEditStoreEnum.MOUSEPOSITION]: MousePositionType
|
||||
[ChartEditStoreEnum.TARGET_CHART]: TargetChartType
|
||||
[ChartEditStoreEnum.COMPONENT_LIST]: any[]
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@ import { loadingStart, loadingFinish, loadingError } from '@/utils'
|
||||
import {
|
||||
chartEditStoreType,
|
||||
EditCanvasType,
|
||||
MousePositionType
|
||||
MousePositionType,
|
||||
TargetChartType
|
||||
} from './chartEditStore.d'
|
||||
|
||||
// 编辑区域内容
|
||||
@@ -35,7 +36,8 @@ export const useChartEditStoreStore = defineStore({
|
||||
y: 0
|
||||
},
|
||||
targetChart: {
|
||||
index: 0
|
||||
hoverIndex: undefined,
|
||||
selectIndex: undefined
|
||||
},
|
||||
componentList: []
|
||||
}),
|
||||
@@ -46,11 +48,25 @@ export const useChartEditStoreStore = defineStore({
|
||||
getEditCanvas(): EditCanvasType {
|
||||
return this.editCanvas
|
||||
},
|
||||
getTargetChart():TargetChartType {
|
||||
return this.targetChart
|
||||
},
|
||||
getComponentList(): any[] {
|
||||
return this.componentList
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
// * 设置 editCanvas 数据项
|
||||
setEditCanvasItem< T extends keyof EditCanvasType, K extends EditCanvasType[T] >(key: T, value: K) {
|
||||
this.editCanvas[key] = value
|
||||
},
|
||||
// * 设置目标数据
|
||||
setTargetHoverChart(hoverIndex?:TargetChartType["hoverIndex"]) {
|
||||
this.targetChart.hoverIndex = hoverIndex
|
||||
},
|
||||
setTargetSelectChart(selectIndex?:TargetChartType["selectIndex"]) {
|
||||
this.targetChart.selectIndex = selectIndex
|
||||
},
|
||||
// * 新增组件列表
|
||||
addComponentList<T>(chartData: T): void {
|
||||
this.componentList.push(chartData)
|
||||
@@ -75,13 +91,6 @@ export const useChartEditStoreStore = defineStore({
|
||||
loadingError()
|
||||
}
|
||||
},
|
||||
// * 设置数据项
|
||||
setEditCanvasItem<
|
||||
T extends keyof EditCanvasType,
|
||||
K extends EditCanvasType[T]
|
||||
>(key: T, value: K) {
|
||||
this.editCanvas[key] = value
|
||||
},
|
||||
// * 设置页面样式属性
|
||||
setPageStyle<T extends keyof CSSStyleDeclaration>(
|
||||
key: T,
|
||||
|
||||
Reference in New Issue
Block a user