diff --git a/src/store/modules/chartEditStore/chartEditStore.ts b/src/store/modules/chartEditStore/chartEditStore.ts index 503cd394..0b239f41 100644 --- a/src/store/modules/chartEditStore/chartEditStore.ts +++ b/src/store/modules/chartEditStore/chartEditStore.ts @@ -60,10 +60,11 @@ export const useChartEditStoreStore = defineStore({ setEditCanvasItem< T extends keyof EditCanvasType, K extends EditCanvasType[T] >(key: T, value: K) { this.editCanvas[key] = value }, - // * 设置目标数据 + // * 设置目标数据 hover setTargetHoverChart(hoverIndex?:TargetChartType["hoverIndex"]) { this.targetChart.hoverIndex = hoverIndex }, + // * 设置目标数据 select setTargetSelectChart(selectIndex?:TargetChartType["selectIndex"]) { this.targetChart.selectIndex = selectIndex }, diff --git a/src/views/chart/ContentEdit/components/EditRange/index.vue b/src/views/chart/ContentEdit/components/EditRange/index.vue index 52275eb1..290b5c27 100644 --- a/src/views/chart/ContentEdit/components/EditRange/index.vue +++ b/src/views/chart/ContentEdit/components/EditRange/index.vue @@ -1,15 +1,22 @@ diff --git a/src/views/chart/ContentEdit/hooks/useLayout.hook.ts b/src/views/chart/ContentEdit/hooks/useLayout.hook.ts index 135b26fa..c3d995c2 100644 --- a/src/views/chart/ContentEdit/hooks/useLayout.hook.ts +++ b/src/views/chart/ContentEdit/hooks/useLayout.hook.ts @@ -1,6 +1,7 @@ -import { onUnmounted, onMounted, ref, nextTick } from 'vue' +import { onUnmounted, onMounted } from 'vue' import { getChartEditStore } from './useStore.hook' import { EditCanvasTypeEnum } from '@/store/modules/chartEditStore/chartEditStore.d' +import { CreateComponentType } from '@/packages/index.d' const chartEditStore = getChartEditStore() @@ -27,4 +28,29 @@ export const useLayout = () => { removeScale() }) }) -} \ No newline at end of file +} + +// 点击事件 +export const mousedownHandle = (e: MouseEvent, item?: CreateComponentType) => { + e.preventDefault() + e.stopPropagation() + if (item) { + chartEditStore.setTargetSelectChart(item.id) + return + } + chartEditStore.setTargetSelectChart(item) +} + +// 进入事件 +export const mouseenterHandle = (e: MouseEvent, item: CreateComponentType) => { + e.preventDefault() + e.stopPropagation() + chartEditStore.setTargetHoverChart(item.id) +} + +// 移出事件 +export const mouseleaveHandle = (e: MouseEvent, item: CreateComponentType) => { + e.preventDefault() + e.stopPropagation() + chartEditStore.setTargetHoverChart(undefined) +} diff --git a/src/views/chart/ContentEdit/index.vue b/src/views/chart/ContentEdit/index.vue index b045d26e..131bf70f 100644 --- a/src/views/chart/ContentEdit/index.vue +++ b/src/views/chart/ContentEdit/index.vue @@ -25,12 +25,18 @@ :on-clickoutside="onClickoutside" @select="handleMenuSelect" /> + diff --git a/src/views/chart/ContentLayers/components/ListItem/index.vue b/src/views/chart/ContentLayers/components/ListItem/index.vue index ec283a2b..680f904b 100644 --- a/src/views/chart/ContentLayers/components/ListItem/index.vue +++ b/src/views/chart/ContentLayers/components/ListItem/index.vue @@ -73,7 +73,7 @@ $textSize: 10px; &.select { border: 1px solid v-bind('themeColor'); /* 需要设置最高级,覆盖 hover 的颜色 */ - background-color: rgba(0, 0, 0, 0) !important; + background-color: rgba(0, 0, 0, 0); } .select-modal, .item-content { @@ -89,10 +89,10 @@ $textSize: 10px; height: calc(100% - 10px); } .select-modal { - background-color: v-bind('themeColor'); - opacity: 0.3; width: 100%; height: 100%; + opacity: 0.3; + background-color: v-bind('themeColor'); } .list-img { flex-shrink: 0;