Demo:给节点的getData方法的返回值增加默认值

This commit is contained in:
wanglin2 2023-10-13 16:09:35 +08:00
parent 74a000723b
commit 84d2a374d1
4 changed files with 6 additions and 6 deletions

View File

@ -70,9 +70,9 @@ export default {
this.activeNodes = [...args[1]]
if (this.activeNodes.length > 0) {
let firstNode = this.activeNodes[0]
this.link = firstNode.getData('hyperlink')
this.link = firstNode.getData('hyperlink') || ''
this.handleUrl(true)
this.linkTitle = firstNode.getData('hyperlinkTitle')
this.linkTitle = firstNode.getData('hyperlinkTitle') || ''
} else {
this.link = ''
this.linkTitle = ''

View File

@ -102,7 +102,7 @@ export default {
this.activeNodes = [...args[1]]
if (this.activeNodes.length > 0) {
let firstNode = this.activeNodes[0]
this.nodeImage = firstNode.getData('image')
this.nodeImage = firstNode.getData('image') || ''
this.iconList = firstNode.getData('icon') || [] //
} else {
this.iconList = []

View File

@ -75,7 +75,7 @@ export default {
this.reset()
if (this.activeNodes.length > 0) {
let firstNode = this.activeNodes[0]
let img = firstNode.getData('image')
let img = firstNode.getData('image') || ''
if (img) {
if (/^https?:\/\//.test(img)) {
this.imgUrl = img
@ -83,7 +83,7 @@ export default {
this.img = img
}
}
this.imgTitle = firstNode.getData('imageTitle')
this.imgTitle = firstNode.getData('imageTitle') || ''
}
this.dialogVisible = true
},

View File

@ -55,7 +55,7 @@ export default {
this.activeNodes = [...args[1]]
if (this.activeNodes.length > 0) {
let firstNode = this.activeNodes[0]
this.note = firstNode.getData('note')
this.note = firstNode.getData('note') || ''
} else {
this.note = ''
}