fix
This commit is contained in:
@ -15,7 +15,7 @@
|
|||||||
:animation="150"
|
:animation="150"
|
||||||
:group="{ name: 'designer', pull: 'clone', put: false }"
|
:group="{ name: 'designer', pull: 'clone', put: false }"
|
||||||
:sort="false"
|
:sort="false"
|
||||||
@clone="clone"
|
:clone="clone"
|
||||||
@start="onStart"
|
@start="onStart"
|
||||||
@end="onEnd"
|
@end="onEnd"
|
||||||
>
|
>
|
||||||
@ -36,8 +36,6 @@
|
|||||||
@update="onPreviewUpdate"
|
@update="onPreviewUpdate"
|
||||||
@stop="onPreviewStop"
|
@stop="onPreviewStop"
|
||||||
>
|
>
|
||||||
{{ store.previewScheme }}
|
|
||||||
|
|
||||||
<DynamicComponent v-for="component in store.previewScheme" :key="component.id" :componentData="component">
|
<DynamicComponent v-for="component in store.previewScheme" :key="component.id" :componentData="component">
|
||||||
{{ component.id }}
|
{{ component.id }}
|
||||||
</DynamicComponent>
|
</DynamicComponent>
|
||||||
@ -52,7 +50,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import {Link} from "@arco-design/web-vue";
|
||||||
import {DraggableEvent, VueDraggable} from "vue-draggable-plus";
|
import {DraggableEvent, VueDraggable} from "vue-draggable-plus";
|
||||||
import {onMounted, ref, watch} from 'vue';
|
import {onMounted, ref, watch} from 'vue';
|
||||||
import {uuid} from 'lsp-uuid';
|
import {uuid} from 'lsp-uuid';
|
||||||
@ -134,7 +132,7 @@ onMounted(() => {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
});
|
});
|
||||||
|
|
||||||
function clone(element: Record<'name' | 'id' | 'type' | 'props' | 'class' | 'text' | 'style' | 'slots', IComponent>) {
|
function clone(element: Record<'name' | 'id' | 'type' | 'props' | 'class' | 'text' | 'style' | 'slots'|'visible'|'disable', IComponent>) {
|
||||||
console.log("clone", element)
|
console.log("clone", element)
|
||||||
return {
|
return {
|
||||||
id: `${element.type}-${uuid()}`,
|
id: `${element.type}-${uuid()}`,
|
||||||
@ -146,9 +144,9 @@ function clone(element: Record<'name' | 'id' | 'type' | 'props' | 'class' | 'tex
|
|||||||
text: element.text,
|
text: element.text,
|
||||||
children: [],
|
children: [],
|
||||||
style: element.style,
|
style: element.style,
|
||||||
visible: "",
|
visible: element.visible,
|
||||||
slots: element.slots,
|
slots: element.slots,
|
||||||
disable: "",
|
disable: element.visible,
|
||||||
events: {},
|
events: {},
|
||||||
loop: {},
|
loop: {},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div style="overflow-y: scroll">
|
||||||
<div style="width: 100%;">
|
<div style="width: 100%;">
|
||||||
<slot name="header"></slot>
|
<slot name="header"></slot>
|
||||||
</div>
|
</div>
|
||||||
<div style="width: 100%;min-height: 480px;background-color: #f7f8fa;">
|
<div style="width: 100%;height: 100%;background-color: #f7f8fa;">
|
||||||
<slot>
|
<slot>
|
||||||
MAIN
|
MAIN
|
||||||
</slot>
|
</slot>
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<component @click.stop="handleClick" :id="componentId" :is="componentType" v-bind="componentProps"
|
<component v-if="componentVisible" @click.stop="handleClick" :id="componentId" :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" />
|
||||||
</template>
|
</template>
|
||||||
<template v-for="(slot, key, index) in componentSlots" :key="index" v-slot:[key]>
|
<template v-for="(slot, key, index) in componentSlots" :key="index" v-slot:[key]>
|
||||||
<DynamicComponent :component-data="slot" />
|
<DynamicComponent :componentData="slot" />
|
||||||
</template>
|
</template>
|
||||||
</component>
|
</component>
|
||||||
</template>
|
</template>
|
||||||
@ -21,18 +21,23 @@ const props = defineProps({
|
|||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// console.log(props.componentData)
|
console.log(props.componentData)
|
||||||
})
|
})
|
||||||
|
|
||||||
const componentId = computed(() => props.componentData?.id || '');
|
const componentId = computed(() => props.componentData?.id || '');
|
||||||
const componentType = computed(() => componentMapping[props.componentData?.type] || 'div');
|
const componentType = computed(() => componentMapping[props.componentData?.type] || 'div');
|
||||||
const componentProps = computed(() => props.componentData?.props || {});
|
const componentProps = computed(() => props.componentData?.props || {});
|
||||||
|
const componentDisable = computed(() => props.componentData?.disable || false);
|
||||||
|
const componentVisible = computed(() => props.componentData?.visible || true);
|
||||||
const componentChildren = computed(() => props.componentData?.children || []);
|
const componentChildren = computed(() => props.componentData?.children || []);
|
||||||
const componentText = computed(() => props.componentData?.text || '');
|
const componentText = computed(() => props.componentData?.text || '');
|
||||||
const componentClass = computed(() => props.componentData?.class || []);
|
const componentClass = computed(() => props.componentData?.class || []);
|
||||||
const componentStyle = computed(() => props.componentData?.style || []);
|
const componentStyle = computed(() => props.componentData?.style || []);
|
||||||
const componentSlots = computed(() => props.componentData?.slots || []);
|
const componentSlots = computed(() => props.componentData?.slots || []);
|
||||||
|
|
||||||
|
console.log("disabled", componentDisable.value);
|
||||||
|
componentProps.value['disabled'] = componentDisable.value
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const updateScheme = () => {
|
const updateScheme = () => {
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
// componentMapping.ts
|
// componentMapping.ts
|
||||||
import TestComponent from './TestComponent.vue';
|
|
||||||
import AdaptivePage from './AdaptivePage.vue';
|
import AdaptivePage from './AdaptivePage.vue';
|
||||||
import Icon from './Icon.tsx';
|
import Icon from './Icon.tsx';
|
||||||
|
|
||||||
@ -31,8 +30,7 @@ import {
|
|||||||
} from '@arco-design/web-vue';
|
} from '@arco-design/web-vue';
|
||||||
|
|
||||||
export const componentMapping: { [key: string]: any } = {
|
export const componentMapping: { [key: string]: any } = {
|
||||||
TestComponent, AdaptivePage,
|
AdaptivePage, Affix, Alert, Anchor, AnchorLink,
|
||||||
Affix, Alert, Anchor, AnchorLink,
|
|
||||||
AutoComplete, Avatar, AvatarGroup, BackTop,
|
AutoComplete, Avatar, AvatarGroup, BackTop,
|
||||||
Badge, Breadcrumb, BreadcrumbItem, Button,
|
Badge, Breadcrumb, BreadcrumbItem, Button,
|
||||||
ButtonGroup, Card, CardGrid, CardMeta,
|
ButtonGroup, Card, CardGrid, CardMeta,
|
||||||
|
|||||||
@ -3,15 +3,19 @@
|
|||||||
"name": "link",
|
"name": "link",
|
||||||
"id": "link",
|
"id": "link",
|
||||||
"designer": {},
|
"designer": {},
|
||||||
"text": "Link",
|
"text": "链接",
|
||||||
"props": {
|
"props": {
|
||||||
"status":""
|
"status":"normal",
|
||||||
|
"href": "https://www.baidu.com",
|
||||||
|
"loading": false,
|
||||||
|
"hoverable": "",
|
||||||
|
"icon": false
|
||||||
},
|
},
|
||||||
"style": "",
|
"style": "",
|
||||||
"class": "",
|
"class": "",
|
||||||
"visible": "",
|
"visible": true,
|
||||||
"slots": {},
|
"slots": {},
|
||||||
"disable": "",
|
"disable": true,
|
||||||
"events": {},
|
"events": {},
|
||||||
"loop": {},
|
"loop": {},
|
||||||
"children": []
|
"children": []
|
||||||
|
|||||||
@ -724,15 +724,19 @@
|
|||||||
"name": "link",
|
"name": "link",
|
||||||
"id": "link",
|
"id": "link",
|
||||||
"designer": {},
|
"designer": {},
|
||||||
"text": "Link",
|
"text": "链接",
|
||||||
"props": {
|
"props": {
|
||||||
"status": ""
|
"status": "normal",
|
||||||
|
"href": "https://www.baidu.com",
|
||||||
|
"loading": false,
|
||||||
|
"hoverable": "",
|
||||||
|
"icon": false
|
||||||
},
|
},
|
||||||
"style": "",
|
"style": "",
|
||||||
"class": "",
|
"class": "",
|
||||||
"visible": "",
|
"visible": "true",
|
||||||
"slots": {},
|
"slots": {},
|
||||||
"disable": "",
|
"disable": "true",
|
||||||
"events": {},
|
"events": {},
|
||||||
"loop": {},
|
"loop": {},
|
||||||
"children": []
|
"children": []
|
||||||
|
|||||||
@ -724,15 +724,19 @@ export const componentScheme = {
|
|||||||
"name": "link",
|
"name": "link",
|
||||||
"id": "link",
|
"id": "link",
|
||||||
"designer": {},
|
"designer": {},
|
||||||
"text": "Link",
|
"text": "链接",
|
||||||
"props": {
|
"props": {
|
||||||
"status": ""
|
"status": "normal",
|
||||||
|
"href": "https://www.baidu.com",
|
||||||
|
"loading": false,
|
||||||
|
"hoverable": "",
|
||||||
|
"icon": false
|
||||||
},
|
},
|
||||||
"style": "",
|
"style": "",
|
||||||
"class": "",
|
"class": "",
|
||||||
"visible": "",
|
"visible": "true",
|
||||||
"slots": {},
|
"slots": {},
|
||||||
"disable": "",
|
"disable": "true",
|
||||||
"events": {},
|
"events": {},
|
||||||
"loop": {},
|
"loop": {},
|
||||||
"children": []
|
"children": []
|
||||||
|
|||||||
@ -36,6 +36,9 @@
|
|||||||
"include": [
|
"include": [
|
||||||
"src/**/*.ts",
|
"src/**/*.ts",
|
||||||
"src/**/*.tsx",
|
"src/**/*.tsx",
|
||||||
"src/**/*.vue"
|
"src/**/*.vue",
|
||||||
|
"preview/**/*.view",
|
||||||
|
"preview/**/*.ts",
|
||||||
|
"preview/**/*.tsx"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user