forked from opentiny/tiny-engine
fix: 画布中右键弹框,修复添加父级-弹出框功能 (#60)
* fix: 画布中右键弹框,修复添加父级-弹出框功能 * fix: schema缺少children * fix: 按检视意见修改
This commit is contained in:
parent
d3e75cecdd
commit
394ab180bb
|
@ -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()) {
|
||||
|
|
Loading…
Reference in New Issue