diff --git a/src/tree-select/tree-select.tsx b/src/tree-select/tree-select.tsx index 685c04352..496528fd9 100644 --- a/src/tree-select/tree-select.tsx +++ b/src/tree-select/tree-select.tsx @@ -319,13 +319,22 @@ export default mixins(getConfigReceiverMixins('treeSelect if (tree && !this.multiple && this.value) { const nodeValue = this.isObjectValue ? (this.value as NodeOptions).value : this.value; - const node = (tree as any).getItem(nodeValue); - this.nodeInfo = { label: node.data[this.realLabel], value: node.data[this.realValue] }; + // 数据源非空 + if (!isEmpty(this.data)) { + const node = (tree as any).getItem(nodeValue); + this.nodeInfo = { label: node.data[this.realLabel], value: node.data[this.realValue] }; + } else { + this.nodeInfo = { label: nodeValue, value: nodeValue }; + } } else if (tree && this.multiple && isArray(this.value)) { this.nodeInfo = this.value.map((value) => { const nodeValue = this.isObjectValue ? (value as NodeOptions).value : value; - const node = (tree as any).getItem(nodeValue); - return { label: node.data[this.realLabel], value: node.data[this.realValue] }; + // 数据源非空 + if (!isEmpty(this.data)) { + const node = (tree as any).getItem(nodeValue); + return { label: node.data[this.realLabel], value: node.data[this.realValue] }; + } + return { label: nodeValue, value: nodeValue }; }); } else { this.nodeInfo = null;