-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tree): 添加form-props-'replaceFields'字段 (#1395)
* feat(tree): 添加form-props-'replaceFields'字段 * test: add test file * docs: 修改实例名称
- Loading branch information
1 parent
5e27ff8
commit 3136e59
Showing
8 changed files
with
115 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<cn> | ||
#### 自定义TreeNode字段 | ||
替换treeNode中 title,key,children字段为treeData中对应的字段 | ||
</cn> | ||
|
||
<us> | ||
#### ReplaceFields | ||
Replace the title,key and children fields in treeNode with the corresponding fields in treeData. | ||
</us> | ||
|
||
```tpl | ||
<template> | ||
<a-tree | ||
checkable | ||
:treeData="treeData" | ||
:defaultExpandedKeys="['0-0-0', '0-0-1']" | ||
:defaultSelectedKeys="['0-0-0', '0-0-1']" | ||
:defaultCheckedKeys="['0-0-0', '0-0-1']" | ||
@select="this.onSelect" | ||
@check="this.onCheck" | ||
:replaceFields="replaceFields"/> | ||
</template> | ||
<script> | ||
const treeData = [ | ||
{ | ||
name: 'parent 1', | ||
key: '0-0', | ||
child: [ | ||
{ | ||
name: '张晨成', | ||
key: '0-0-0', | ||
disabled: true, | ||
child: [ | ||
{ name: 'leaf', key: '0-0-0-0', disableCheckbox: true }, | ||
{ name: 'leaf', key: '0-0-0-1' }, | ||
], | ||
}, | ||
{ | ||
name: 'parent 1-1', | ||
key: '0-0-1', | ||
child: [{ key: '0-0-1-0', name:'zcvc' }], | ||
}, | ||
], | ||
}, | ||
]; | ||
export default { | ||
data() { | ||
return { | ||
treeData, | ||
replaceFields:{ | ||
children:'child', | ||
title:'name' | ||
} | ||
}; | ||
}, | ||
methods: { | ||
onSelect(selectedKeys, info) { | ||
console.log('selected', selectedKeys, info); | ||
}, | ||
onCheck(checkedKeys, info) { | ||
console.log('onCheck', checkedKeys, info); | ||
}, | ||
}, | ||
}; | ||
</script> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters