调整触发点击事件的元素

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,6 +1,6 @@
<template> <template>
<div :id="componentId" @click="handleClick"> <component @click.stop="handleClick" :id="componentId" :is="componentType" v-bind="componentProps"
<component :is="componentType" v-bind="componentProps" :class="componentClass" :style="componentStyle"> :class="componentClass" :style="componentStyle">
{{ componentText }} {{ componentText }}
<template v-for="child in componentChildren" :key="child.id"> <template v-for="child in componentChildren" :key="child.id">
<DynamicComponent :component-data="child" /> <DynamicComponent :component-data="child" />
@ -9,7 +9,6 @@
<DynamicComponent :component-data="slot" /> <DynamicComponent :component-data="slot" />
</template> </template>
</component> </component>
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { defineProps, computed, onMounted } from 'vue'; import { defineProps, computed, onMounted } from 'vue';

View File

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