Skip to content

Commit

Permalink
fix: 画布中右键弹框,修复添加父级-弹出框功能 (#60)
Browse files Browse the repository at this point in the history
* fix: 画布中右键弹框,修复添加父级-弹出框功能

* fix: schema缺少children

* fix: 按检视意见修改
  • Loading branch information
lhuans authored Dec 19, 2023
1 parent d3e75ce commit 394ab18
Showing 1 changed file with 48 additions and 10 deletions.
58 changes: 48 additions & 10 deletions packages/canvas/src/components/container/CanvasMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit 394ab18

Please sign in to comment.