Commit 9e67ec35 authored by Leopoldthecoder's avatar Leopoldthecoder Committed by 杨奕

Tree: get prop from data if not specified in `props`

parent 2fae006b
...@@ -878,7 +878,7 @@ Only one node among the same level can be expanded at one time. ...@@ -878,7 +878,7 @@ Only one node among the same level can be expanded at one time.
| --------- | ---------------------------------------- | ------ | --------------- | ------- | | --------- | ---------------------------------------- | ------ | --------------- | ------- |
| label | specify which key of node object is used as the node's label | string, function(data, node) | — | — | | label | specify which key of node object is used as the node's label | string, function(data, node) | — | — |
| children | specify which node object is used as the node's subtree | string, function(data, node) | — | — | | children | specify which node object is used as the node's subtree | string, function(data, node) | — | — |
| disabled | specify which node's checkbox disabled | boolean, function(data, node) | — | — | | disabled | specify which key of node object represents if node's checkbox is disabled | boolean, function(data, node) | — | — |
### Method ### Method
`Tree` has the following method, which returns the currently selected array of nodes. `Tree` has the following method, which returns the currently selected array of nodes.
......
...@@ -877,7 +877,7 @@ ...@@ -877,7 +877,7 @@
| -------- | ----------------- | ------ | ---- | ---- | | -------- | ----------------- | ------ | ---- | ---- |
| label | 指定节点标签为节点对象的某个属性值 | string, function(data, node) | — | — | | label | 指定节点标签为节点对象的某个属性值 | string, function(data, node) | — | — |
| children | 指定子树为节点对象的某个属性值 | string, function(data, node) | — | — | | children | 指定子树为节点对象的某个属性值 | string, function(data, node) | — | — |
| disabled | 指定节点选择框是否禁用 | boolean, function(data, node) | — | — | | disabled | 指定节点选择框是否禁用为节点对象的某个属性值 | boolean, function(data, node) | — | — |
### 方法 ### 方法
`Tree` 拥有如下方法,返回目前被选中的节点数组: `Tree` 拥有如下方法,返回目前被选中的节点数组:
......
...@@ -68,7 +68,8 @@ const getPropertyFromData = function(node, prop) { ...@@ -68,7 +68,8 @@ const getPropertyFromData = function(node, prop) {
} else if (typeof config === 'string') { } else if (typeof config === 'string') {
return data[config]; return data[config];
} else if (typeof config === 'undefined') { } else if (typeof config === 'undefined') {
return ''; const dataProp = data[prop];
return dataProp === undefined ? '' : dataProp;
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment