Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
1 change: 1 addition & 0 deletions packages/canvas/src/components/render/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ const parseI18n = (i18n, scope, ctx) => {

const renderDefault = (children, scope, parent) =>
children.map?.((child) =>
// eslint-disable-next-line no-use-before-define
h(renderer, {
schema: child,
scope,
Expand Down