Browse Source

fix: tree fieldNames for key error, close #4790

pull/4825/head
tangjinzhou 3 years ago
parent
commit
40d08f73bb
  1. 2
      components/tree/index.en-US.md
  2. 2
      components/tree/index.zh-CN.md
  3. 2
      components/vc-tree/Tree.tsx

2
components/tree/index.en-US.md

@ -18,7 +18,7 @@ Almost anything can be represented in a tree structure. Examples include directo
| Property | Description | Type | Default | Version | | Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| treeData | treeNode of tree, please use `treeNodes` before v1.1.4 | [TreeNode[]](#TreeNode) | - | | | treeData | treeNode of tree, please use `treeNodes` before v1.1.4 | [TreeNode[]](#TreeNode) | - | |
| replaceFields | Replace the title,key and children fields in treeNode with the corresponding fields in treeData | object | { children:'children', title:'title', key:'key' } | | | fieldNames | Replace the title,key and children fields in treeNode with the corresponding fields in treeData | object | { children:'children', title:'title', key:'key' } | 3.0.0 |
| autoExpandParent | Whether to automatically expand a parent treeNode | boolean | true | | | autoExpandParent | Whether to automatically expand a parent treeNode | boolean | true | |
| blockNode | Whether treeNode fill remaining horizontal space | boolean | false | | | blockNode | Whether treeNode fill remaining horizontal space | boolean | false | |
| checkable | Adds a `Checkbox` before the treeNodes | boolean | false | | | checkable | Adds a `Checkbox` before the treeNodes | boolean | false | |

2
components/tree/index.zh-CN.md

@ -20,7 +20,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/Xh-oWqg9k/Tree.svg
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| blockNode | 是否节点占据一行 | boolean | false | | | blockNode | 是否节点占据一行 | boolean | false | |
| treeData | treeNodes 数据,如果设置则不需要手动构造 TreeNode 节点(key 在整个树范围内唯一) | [TreeNode[]](#TreeNode) | -- | | | treeData | treeNodes 数据,如果设置则不需要手动构造 TreeNode 节点(key 在整个树范围内唯一) | [TreeNode[]](#TreeNode) | -- | |
| replaceFields | 替换 treeNode 中 title,key,children 字段为 treeData 中对应的字段 | object | {children:'children', title:'title', key:'key' } | | | fieldNames | 替换 treeNode 中 title,key,children 字段为 treeData 中对应的字段 | object | {children:'children', title:'title', key:'key' } | 3.0.0 |
| autoExpandParent | 是否自动展开父节点 | boolean | true | | | autoExpandParent | 是否自动展开父节点 | boolean | true | |
| checkable | 节点前添加 Checkbox 复选框 | boolean | false | | | checkable | 节点前添加 Checkbox 复选框 | boolean | false | |
| checkedKeys(v-model) | (受控)选中复选框的树节点(注意:父子节点有关联,如果传入父节点 key,则子节点自动选中;相应当子节点 key 都传入,父节点也自动选中。当设置`checkable`和`checkStrictly`,它是一个有`checked`和`halfChecked`属性的对象,并且父子节点的选中与否不再关联 | string\[] \| number\[] \| {checked: string\[] \| number\[], halfChecked: string\[] \| number\[]} | \[] | | | checkedKeys(v-model) | (受控)选中复选框的树节点(注意:父子节点有关联,如果传入父节点 key,则子节点自动选中;相应当子节点 key 都传入,父节点也自动选中。当设置`checkable`和`checkStrictly`,它是一个有`checked`和`halfChecked`属性的对象,并且父子节点的选中与否不再关联 | string\[] \| number\[] \| {checked: string\[] \| number\[], halfChecked: string\[] \| number\[]} | \[] | |

2
components/vc-tree/Tree.tsx

@ -595,7 +595,7 @@ export default defineComponent({
const onNodeCheck = (e: MouseEvent, treeNode: EventDataNode, checked: boolean) => { const onNodeCheck = (e: MouseEvent, treeNode: EventDataNode, checked: boolean) => {
const { checkStrictly, onCheck } = props; const { checkStrictly, onCheck } = props;
const { key } = treeNode; const key = treeNode[fieldNames.value.key];
// Prepare trigger arguments // Prepare trigger arguments
let checkedObj; let checkedObj;

Loading…
Cancel
Save