This commit is contained in:
lhj
2024-11-17 17:29:03 +08:00
parent 2e1d590c89
commit 192ae66997
4 changed files with 45 additions and 27 deletions

View File

@ -6,7 +6,7 @@
:class="[
'dynamic-component',
{ 'hover-state': isHovered && store.designerMode },
{ 'click-state': componentSelected && store.designerMode }
{ 'click-state': componentSelected && store.designerMode &&isComponent }
]"
@click.stop="handleClick"
@mouseover="isHovered = true"
@ -15,7 +15,7 @@
<div v-if="isHovered && store.designerMode" class="component-header">
<span>{{ componentName }}</span>
</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: 6px 5px 5px 5px;display: flex;width: fit-content;flex-wrap: nowrap">
<icon-copy class="clickable" size="20" />
@ -51,7 +51,7 @@ const store = useSchemeStore();
const props = defineProps({
componentData: Object
});
const isComponent=ref(true)
const componentId = computed(() => props.componentData?.id || '');
const componentName = computed(() => props.componentData?.name || 'Unnamed Component');
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 componentSelected = computed(() => store.nowComponentsData?.id && props.componentData?.id === store.nowComponentsData?.id);
onMounted(() => {
debugger
isComponent.value=props.componentData?.type!='AdaptivePage';
adjustHeaderPosition();
});
// 确保 componentProps 包含 disabled 属性
const componentPropsWithDisabled = computed(() => ({
...componentProps.value,
@ -143,9 +150,7 @@ const adjustHeaderPosition = () => {
};
};
onMounted(() => {
adjustHeaderPosition();
});
watch(() => componentSelected.value, () => {
if (componentSelected.value) {