Skip to content

Commit 40d08f7

Browse files
committed
fix: tree fieldNames for key error, close #4790
1 parent f6868ab commit 40d08f7

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

components/tree/index.en-US.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Almost anything can be represented in a tree structure. Examples include directo
1818
| Property | Description | Type | Default | Version |
1919
| --- | --- | --- | --- | --- |
2020
| treeData | treeNode of tree, please use `treeNodes` before v1.1.4 | [TreeNode[]](#TreeNode) | - | |
21-
| replaceFields | Replace the title,key and children fields in treeNode with the corresponding fields in treeData | object | { children:'children', title:'title', key:'key' } | |
21+
| 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 |
2222
| autoExpandParent | Whether to automatically expand a parent treeNode | boolean | true | |
2323
| blockNode | Whether treeNode fill remaining horizontal space | boolean | false | |
2424
| checkable | Adds a `Checkbox` before the treeNodes | boolean | false | |

components/tree/index.zh-CN.md

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

components/vc-tree/Tree.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ export default defineComponent({
595595

596596
const onNodeCheck = (e: MouseEvent, treeNode: EventDataNode, checked: boolean) => {
597597
const { checkStrictly, onCheck } = props;
598-
const { key } = treeNode;
598+
const key = treeNode[fieldNames.value.key];
599599

600600
// Prepare trigger arguments
601601
let checkedObj;

0 commit comments

Comments
 (0)