diff --git a/packages/canvas/src/components/container/CanvasAction.vue b/packages/canvas/src/components/container/CanvasAction.vue index c5d6a66..ec2164d 100644 --- a/packages/canvas/src/components/container/CanvasAction.vue +++ b/packages/canvas/src/components/container/CanvasAction.vue @@ -229,7 +229,10 @@ export default { } const showAction = computed(() => { - const { parent } = getCurrent() + const { schema, parent } = getCurrent() + if (schema?.props?.['data-id'] === 'root-container') { + return false + } return !props.resize && parent && parent?.type !== 'JSSlot' }) diff --git a/packages/canvas/src/components/render/RenderMain.js b/packages/canvas/src/components/render/RenderMain.js index 6081d48..93a3962 100644 --- a/packages/canvas/src/components/render/RenderMain.js +++ b/packages/canvas/src/components/render/RenderMain.js @@ -379,7 +379,8 @@ export default { // 渲染画布增加根节点,与出码和预览保持一致 const rootChildrenSchema = { componentName: 'div', - props: schema.props, + // 手动添加一个唯一的属性,后续在画布选中此节点时方便处理额外的逻辑。由于没有修改schema,不会影响出码 + props: { ...schema.props, 'data-id': 'root-container' }, children: schema.children }