调整触发点击事件的元素

This commit is contained in:
lhj
2024-10-03 15:48:50 +08:00
parent 9e614657d7
commit 9fbbc8a2a7
2 changed files with 11 additions and 12 deletions

View File

@ -1,15 +1,14 @@
<template>
<div :id="componentId" @click="handleClick">
<component :is="componentType" v-bind="componentProps" :class="componentClass" :style="componentStyle">
{{ componentText }}
<template v-for="child in componentChildren" :key="child.id">
<DynamicComponent :component-data="child" />
</template>
<template v-for="(slot, key, index) in componentSlots" :key="index" v-slot:[key]>
<DynamicComponent :component-data="slot" />
</template>
</component>
</div>
<component @click.stop="handleClick" :id="componentId" :is="componentType" v-bind="componentProps"
:class="componentClass" :style="componentStyle">
{{ componentText }}
<template v-for="child in componentChildren" :key="child.id">
<DynamicComponent :component-data="child" />
</template>
<template v-for="(slot, key, index) in componentSlots" :key="index" v-slot:[key]>
<DynamicComponent :component-data="slot" />
</template>
</component>
</template>
<script setup lang="ts">
import { defineProps, computed, onMounted } from 'vue';

View File

@ -69,7 +69,7 @@ useDraggable(el2, componentsList, {
},
clone(element) {
return {
id: uuid(),
id: `${element.type}-${uuid()}`,
name: element.name,
type: element.type,
props: element.props,