Skip to content

Commit

Permalink
fix: 修复空页面执行右建操作时控制台报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
gargameljyh committed Nov 23, 2023
1 parent aaaa997 commit c407f2c
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions packages/canvas/src/components/container/CanvasMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ export default {
const operations = {
del() {
const curSchemaId = getCurrent().schema?.id
if (curSchemaId) {
removeNodeById(curSchemaId)
const currentSchemaId = getCurrent().schema?.id
if (currentSchemaId) {
removeNodeById(currentSchemaId)
}
},
copy() {
const curSchemaId = getCurrent().schema?.id
if (curSchemaId) {
copyNode(curSchemaId)
const currentSchemaId = getCurrent().schema?.id
if (currentSchemaId) {
copyNode(currentSchemaId)
}
},
config() {
Expand All @@ -131,17 +131,19 @@ export default {
wrap({ value, name }) {
const componentName = value || name
const { schema, parent } = getCurrent()
const index = parent.children.indexOf(schema)
const wrapSchema = {
componentName,
id: null,
props: {},
children: [schema]
}
if (schema && parent) {
const index = parent.children.indexOf(schema)
const wrapSchema = {
componentName,
id: null,
props: {},
children: [schema]
}
parent.children.splice(index, 1, wrapSchema)
parent.children.splice(index, 1, wrapSchema)
getController().addHistory()
getController().addHistory()
}
},
createBlock() {
if (useCanvas().isSaved()) {
Expand Down

0 comments on commit c407f2c

Please sign in to comment.