fix
This commit is contained in:
2
components.d.ts
vendored
2
components.d.ts
vendored
@ -8,9 +8,7 @@ export {}
|
|||||||
declare module 'vue' {
|
declare module 'vue' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
AdaptivePage: typeof import('./src/components/AdaptivePage.vue')['default']
|
AdaptivePage: typeof import('./src/components/AdaptivePage.vue')['default']
|
||||||
Designer: typeof import('./src/components/Designer.vue')['default']
|
|
||||||
DynamicComponent: typeof import('./src/components/DynamicComponent.vue')['default']
|
DynamicComponent: typeof import('./src/components/DynamicComponent.vue')['default']
|
||||||
MainView: typeof import('./src/components/MainView.vue')['default']
|
|
||||||
NestedFunction: typeof import('./src/components/NestedFunction.vue')['default']
|
NestedFunction: typeof import('./src/components/NestedFunction.vue')['default']
|
||||||
PropertyEditor: typeof import('./src/components/PropertyEditor.vue')['default']
|
PropertyEditor: typeof import('./src/components/PropertyEditor.vue')['default']
|
||||||
RouterLink: typeof import('vue-router')['RouterLink']
|
RouterLink: typeof import('vue-router')['RouterLink']
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
:class="[
|
:class="[
|
||||||
'dynamic-component',
|
'dynamic-component',
|
||||||
{ 'hover-state': isHovered && store.designerMode },
|
{ 'hover-state': isHovered && store.designerMode },
|
||||||
{ 'click-state': componentSelected && store.designerMode }
|
{ 'click-state': componentSelected && store.designerMode &&isComponent }
|
||||||
]"
|
]"
|
||||||
@click.stop="handleClick"
|
@click.stop="handleClick"
|
||||||
@mouseover="isHovered = true"
|
@mouseover="isHovered = true"
|
||||||
@ -15,7 +15,7 @@
|
|||||||
<div v-if="isHovered && store.designerMode" class="component-header">
|
<div v-if="isHovered && store.designerMode" class="component-header">
|
||||||
<span>{{ componentName }}</span>
|
<span>{{ componentName }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="componentSelected && store.designerMode" class="component-header" :style="headerStyle">
|
<div v-if="componentSelected && store.designerMode&&isComponent" class="component-header" :style="headerStyle">
|
||||||
<div style="background-color:#3457cc;color: #ffffff;padding: 5px ;margin-right: 2px">{{ componentName }}</div>
|
<div style="background-color:#3457cc;color: #ffffff;padding: 5px ;margin-right: 2px">{{ componentName }}</div>
|
||||||
<div style="background-color:#3457cc;color:#ffffff;padding: 6px 5px 5px 5px;display: flex;width: fit-content;flex-wrap: nowrap">
|
<div style="background-color:#3457cc;color:#ffffff;padding: 6px 5px 5px 5px;display: flex;width: fit-content;flex-wrap: nowrap">
|
||||||
<icon-copy class="clickable" size="20" />
|
<icon-copy class="clickable" size="20" />
|
||||||
@ -51,7 +51,7 @@ const store = useSchemeStore();
|
|||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
componentData: Object
|
componentData: Object
|
||||||
});
|
});
|
||||||
|
const isComponent=ref(true)
|
||||||
const componentId = computed(() => props.componentData?.id || '');
|
const componentId = computed(() => props.componentData?.id || '');
|
||||||
const componentName = computed(() => props.componentData?.name || 'Unnamed Component');
|
const componentName = computed(() => props.componentData?.name || 'Unnamed Component');
|
||||||
const componentType = computed(() => markRaw(componentMapping[props.componentData?.type]) || 'div');
|
const componentType = computed(() => markRaw(componentMapping[props.componentData?.type]) || 'div');
|
||||||
@ -65,6 +65,13 @@ const componentStyle = computed(() => props.componentData?.style || []);
|
|||||||
const componentSlots = computed(() => props.componentData?.slots || {});
|
const componentSlots = computed(() => props.componentData?.slots || {});
|
||||||
const componentSelected = computed(() => store.nowComponentsData?.id && props.componentData?.id === store.nowComponentsData?.id);
|
const componentSelected = computed(() => store.nowComponentsData?.id && props.componentData?.id === store.nowComponentsData?.id);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
debugger
|
||||||
|
isComponent.value=props.componentData?.type!='AdaptivePage';
|
||||||
|
adjustHeaderPosition();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// 确保 componentProps 包含 disabled 属性
|
// 确保 componentProps 包含 disabled 属性
|
||||||
const componentPropsWithDisabled = computed(() => ({
|
const componentPropsWithDisabled = computed(() => ({
|
||||||
...componentProps.value,
|
...componentProps.value,
|
||||||
@ -143,9 +150,7 @@ const adjustHeaderPosition = () => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
adjustHeaderPosition();
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(() => componentSelected.value, () => {
|
watch(() => componentSelected.value, () => {
|
||||||
if (componentSelected.value) {
|
if (componentSelected.value) {
|
||||||
|
|||||||
@ -1,17 +1,22 @@
|
|||||||
[
|
{
|
||||||
{
|
"type": "AdaptivePage",
|
||||||
"id": "AdaptivePage-4e510f833910000",
|
"name": "AdaptivePage",
|
||||||
"name": "AdaptivePage",
|
"id": "AdaptivePage",
|
||||||
"type": "AdaptivePage",
|
"version": "2.0",
|
||||||
"props": {},
|
"props": {},
|
||||||
"class": "",
|
"class": "",
|
||||||
"designer": "",
|
"style": "",
|
||||||
"children": [],
|
"variables": {},
|
||||||
"style": "",
|
"dataSources": {},
|
||||||
"visible": true,
|
"functions": {},
|
||||||
"slots": {},
|
"orchestrations": {},
|
||||||
"disable": true,
|
"events": {},
|
||||||
"events": {},
|
"slots": {},
|
||||||
"loop": {}
|
"header": [],
|
||||||
}
|
"footer": [],
|
||||||
]
|
"body": [],
|
||||||
|
"meta": {},
|
||||||
|
"visible": true,
|
||||||
|
"disable": false,
|
||||||
|
"designer": {}
|
||||||
|
}
|
||||||
@ -137,7 +137,10 @@ onMounted(() => {
|
|||||||
initScheme();
|
initScheme();
|
||||||
});
|
});
|
||||||
|
|
||||||
function clone(element: Record<'name' | 'id' | 'type' | 'props' | 'class' | 'text' | 'style' | 'slots' | 'visible' | 'disable' | 'children', IComponent>) {
|
function clone(element: Record<'name' | 'id' | 'type' | 'props' | 'class' | 'text' | 'style' | 'slots' | 'visible'
|
||||||
|
| 'disable'|'header'|'footer'|'dataSources'|'functions'|'variables'
|
||||||
|
|'orchestrations'|'events'
|
||||||
|
|'meta' | 'children'|'body'|'designer', IComponent>) {
|
||||||
// console.log("clone", element);
|
// console.log("clone", element);
|
||||||
return {
|
return {
|
||||||
id: `${element.type}-${uuid()}`,
|
id: `${element.type}-${uuid()}`,
|
||||||
@ -145,7 +148,6 @@ function clone(element: Record<'name' | 'id' | 'type' | 'props' | 'class' | 'tex
|
|||||||
type: element.type,
|
type: element.type,
|
||||||
props: element.props,
|
props: element.props,
|
||||||
class: element.class,
|
class: element.class,
|
||||||
designer: '',
|
|
||||||
text: element.text,
|
text: element.text,
|
||||||
children: element.children || [],
|
children: element.children || [],
|
||||||
style: element.style,
|
style: element.style,
|
||||||
@ -154,6 +156,14 @@ function clone(element: Record<'name' | 'id' | 'type' | 'props' | 'class' | 'tex
|
|||||||
disable: element.visible,
|
disable: element.visible,
|
||||||
events: {},
|
events: {},
|
||||||
loop: {},
|
loop: {},
|
||||||
|
body: element.body,
|
||||||
|
designer:element.designer||{},
|
||||||
|
dataSources:element.dataSources,
|
||||||
|
functions:element.functions,
|
||||||
|
variables:element.variables,
|
||||||
|
orchestrations:element.orchestrations,
|
||||||
|
footer:element.footer,
|
||||||
|
meta:element.meta,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user