From 394ab180bb78eee41f3cc884db2f67d4d32c4b2a Mon Sep 17 00:00:00 2001 From: lhuans <145339349+lhuans@users.noreply.github.com> Date: Mon, 18 Dec 2023 22:42:07 -0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=94=BB=E5=B8=83=E4=B8=AD=E5=8F=B3?= =?UTF-8?q?=E9=94=AE=E5=BC=B9=E6=A1=86=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=88=B6=E7=BA=A7-=E5=BC=B9=E5=87=BA=E6=A1=86?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=20(#60)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 画布中右键弹框,修复添加父级-弹出框功能 * fix: schema缺少children * fix: 按检视意见修改 --- .../src/components/container/CanvasMenu.vue | 58 +++++++++++++++---- 1 file changed, 48 insertions(+), 10 deletions(-) diff --git a/packages/canvas/src/components/container/CanvasMenu.vue b/packages/canvas/src/components/container/CanvasMenu.vue index 26ce7ce3a..c03ee387d 100644 --- a/packages/canvas/src/components/container/CanvasMenu.vue +++ b/packages/canvas/src/components/container/CanvasMenu.vue @@ -132,19 +132,57 @@ export default { wrap({ value, name }) { const componentName = value || name const { schema, parent } = getCurrent() - if (schema && parent) { - const index = parent.children.indexOf(schema) - const wrapSchema = { - componentName, - id: null, - props: {}, - children: [schema] - } - parent.children.splice(index, 1, wrapSchema) + if (!schema || !parent) { + return + } - getController().addHistory() + const index = parent.children.findIndex(({ id }) => schema.id === id) + let wrapSchema = { + componentName, + id: null, + props: { + content: '提示信息' + }, + children: [schema] + } + // 需要对popover特殊处理 + if (value === 'TinyPopover') { + wrapSchema = { + componentName, + props: { + width: 200, + title: '弹框标题', + trigger: 'manual', + modelValue: true + }, + children: [ + { + componentName: 'Template', + props: { + slot: 'reference' + }, + children: [schema] + }, + { + componentName: 'Template', + props: { + slot: 'default' + }, + children: [ + { + componentName: 'div', + props: { + placeholder: '提示内容' + } + } + ] + } + ] + } } + parent.children.splice(index, 1, wrapSchema) + getController().addHistory() }, createBlock() { if (useCanvas().isSaved()) {