mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
fix:修改删除的bug
This commit is contained in:
@@ -31,11 +31,11 @@ const chartEditStore = useChartEditStoreStore()
|
||||
|
||||
// 计算当前选中目标
|
||||
const hover = computed(() => {
|
||||
return props.item.id === chartEditStore.getTargetChart.hoverIndex
|
||||
return props.item.id === chartEditStore.getTargetChart.hoverId
|
||||
})
|
||||
|
||||
const select = computed(() => {
|
||||
return props.item.id === chartEditStore.getTargetChart.selectIndex
|
||||
return props.item.id === chartEditStore.getTargetChart.selectId
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ export const mousedownHandleUnStop = (
|
||||
chartEditStore.setTargetSelectChart(item.id)
|
||||
return
|
||||
}
|
||||
chartEditStore.setTargetSelectChart(item)
|
||||
chartEditStore.setTargetSelectChart(undefined)
|
||||
}
|
||||
|
||||
// 移动图表
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
@mousedown="mousedownHandle($event, item)"
|
||||
@mouseenter="mouseenterHandle($event, item)"
|
||||
@mouseleave="mouseleaveHandle($event, item)"
|
||||
@contextmenu="handleContextMenu($event, index)"
|
||||
@contextmenu="handleContextMenu($event, item)"
|
||||
>
|
||||
<component
|
||||
class="edit-content-chart"
|
||||
|
||||
@@ -43,11 +43,11 @@ const { image, title } = toRefs(props.componentData.chartData)
|
||||
|
||||
// 计算当前选中目标
|
||||
const select = computed(() => {
|
||||
return props.componentData.id === chartEditStore.getTargetChart.selectIndex
|
||||
return props.componentData.id === chartEditStore.getTargetChart.selectId
|
||||
})
|
||||
|
||||
const hover = computed(() => {
|
||||
return props.componentData.id === chartEditStore.getTargetChart.hoverIndex
|
||||
return props.componentData.id === chartEditStore.getTargetChart.hoverId
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
|
||||
<!-- 图层内容 -->
|
||||
<ListItem
|
||||
v-for="item in chartEditStore.getComponentList"
|
||||
v-for="(item) in chartEditStore.getComponentList"
|
||||
:key="item.id"
|
||||
:componentData="item"
|
||||
@mousedown="mousedownHandle(item)"
|
||||
@mouseenter="mouseenterHandle(item)"
|
||||
@mouseleave="mouseleaveHandle(item)"
|
||||
@contextmenu="handleContextMenu($event, index)"
|
||||
@contextmenu="handleContextMenu($event, item)"
|
||||
/>
|
||||
</ContentBox>
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { ref, nextTick } from 'vue'
|
||||
import { useChartEditStoreStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { loadingError } from '@/utils'
|
||||
|
||||
const chartEditStore = useChartEditStoreStore()
|
||||
@@ -27,8 +28,6 @@ export const useContextMenu = (menuOption?: {
|
||||
const selfOptions = menuOption?.selfOptions
|
||||
const optionsHandle = menuOption?.optionsHandle
|
||||
|
||||
const targetIndex = ref<number>(0)
|
||||
|
||||
// * 默认选项
|
||||
const defaultOptions: MenuOptionsItemType[] = [
|
||||
{
|
||||
@@ -42,10 +41,9 @@ export const useContextMenu = (menuOption?: {
|
||||
const menuOptions: MenuOptionsItemType[] = selfOptions || defaultOptions
|
||||
|
||||
// * 右键处理
|
||||
const handleContextMenu = (e: MouseEvent, index: number) => {
|
||||
const handleContextMenu = (e: MouseEvent, item: CreateComponentType) => {
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
targetIndex.value = index
|
||||
let target = e.target
|
||||
while (target instanceof SVGElement) {
|
||||
target = target.parentNode
|
||||
@@ -69,9 +67,9 @@ export const useContextMenu = (menuOption?: {
|
||||
(e: MenuOptionsItemType) => e.key === key
|
||||
)
|
||||
if (!targetItem) loadingError()
|
||||
if (targetItem.length) targetItem.pop()?.fnHandle(targetIndex.value)
|
||||
if (targetItem.length) targetItem.pop()?.fnHandle()
|
||||
}
|
||||
console.log(optionsHandle ? optionsHandle(menuOptions) : menuOptions)
|
||||
|
||||
return {
|
||||
menuOptions: optionsHandle ? optionsHandle(menuOptions) : menuOptions,
|
||||
handleContextMenu,
|
||||
|
||||
Reference in New Issue
Block a user