fix:完善根据id查询并修改对应组件的数据

This commit is contained in:
lhj
2024-11-09 23:18:21 +08:00
parent 8600606845
commit 91471748f3
5 changed files with 163 additions and 28 deletions

View File

@ -36,7 +36,7 @@
@update="onPreviewUpdate"
@stop="onPreviewStop"
>
{{store.previewScheme}}
<!-- {{store.previewScheme}}-->
<DynamicComponent v-for="component in store.previewScheme" :key="component.id" :componentData="component">
{{ component.id }}
</DynamicComponent>
@ -51,6 +51,7 @@
</template>
<script setup lang="ts">
import {RadioGroup,Radio} from '@arco-design/web-vue'
import {onMounted, ref, watch} from 'vue';
import {uuid} from 'lsp-uuid';
import {componentScheme} from "@/schemes/scheme";
@ -58,7 +59,7 @@ import {useSchemeStore} from '@/stores/useSchemeStore';
import {IComponent} from "@/type/IComponent";
import DynamicComponent from "@/components/DynamicComponent.vue";
import PropertyEditor from "@/components/PropertyEditor.vue";
import {VueDraggable} from "vue-draggable-plus";
import {DraggableEvent, VueDraggable} from "vue-draggable-plus";
let list0 = ref([])
@ -132,7 +133,7 @@ onMounted(() => {
// @ts-ignore
});
function clone(element: Record<'name' | 'id' | 'type' | 'props' | 'class' | 'text' | 'style' | 'slots'|'visible'|'disable', IComponent>) {
function clone(element: Record<'name' | 'id' | 'type' | 'props' | 'class' | 'text' | 'style' | 'slots'|'visible'|'disable'|'children', IComponent>) {
console.log("clone", element)
return {
id: `${element.type}-${uuid()}`,
@ -142,7 +143,7 @@ function clone(element: Record<'name' | 'id' | 'type' | 'props' | 'class' | 'tex
class: element.class,
designer: '',
text: element.text,
children: [],
children: element.children||[],
style: element.style,
visible: element.visible,
slots: element.slots,
@ -154,6 +155,7 @@ function clone(element: Record<'name' | 'id' | 'type' | 'props' | 'class' | 'tex
const onEnd = (event: DraggableEvent) => {
console.log("onEnd", event)
store.nowComponentsData=event.clonedData
// const {oldDraggableIndex} = obj;
// store.previewData(store.component[oldDraggableIndex]);
// store.nowComponentsData(store.component[oldDraggableIndex]);