fix: 画布中右键弹框,修复添加父级-弹出框功能 (#60)

* fix: 画布中右键弹框,修复添加父级-弹出框功能

* fix: schema缺少children

* fix: 按检视意见修改
This commit is contained in:
lhuans 2023-12-18 22:42:07 -08:00 committed by GitHub
parent d3e75cecdd
commit 394ab180bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 49 additions and 11 deletions

View File

@ -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 = {
if (!schema || !parent) {
return
}
const index = parent.children.findIndex(({ id }) => schema.id === id)
let wrapSchema = {
componentName,
id: null,
props: {},
props: {
content: '提示信息'
},
children: [schema]
}
parent.children.splice(index, 1, wrapSchema)
getController().addHistory()
// 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()) {