这样判空就会报错
loadNode(node, resolve)
console.log("node")
console.log(node)
if (node.data !== null) {
this.get(ctx + '/publicity/publicityType/typeTreeData?id=' + node.data.id).then((res) => {
resolve(res)
})
}
},
需要这样写,用typeof来做类型判断
console.log("node")
console.log(node)
if (typeof node.data !== 'undefined') {
this.get(ctx + '/publicity/publicityType/typeTreeData?id='+node.data.id).then((res) => {
resolve(res)
})
}else {
this.get(ctx + '/publicity/publicityType/typeTreeData?id='+this.typeId).then((res) => {
resolve(res)
})
}