mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-05 20:58:22 +08:00
feat(components): [tree-v2] add setExpendKeys
method (#9412)
* feat(components): [tree-v2] add `setExpendKeys` method * chore: update docs
This commit is contained in:
parent
3a6fc23f49
commit
9cb8ce47e8
@ -105,6 +105,7 @@ tree-v2/filter
|
||||
| getCheckedKeys | If the node can be selected (`show-checkbox` is `true`), it returns the currently selected array of node's keys | `(leafOnly: boolean)` |
|
||||
| setCheckedKeys | set certain nodes to be checked | `(keys: TreeKey[])` |
|
||||
| setChecked | set node to be checked or not | `(key: TreeKey, checked: boolean)` |
|
||||
| setExpendKeys | set certain nodes to be expand | `(keys: TreeKey[])` |
|
||||
| getHalfCheckedNodes | If the node can be selected (`show-checkbox` is `true`), it returns the currently half selected array of nodes | - |
|
||||
| getHalfCheckedKeys | If the node can be selected (`show-checkbox` is `true`), it returns the currently half selected array of node's keys | - |
|
||||
| getCurrentKey | return the highlight node's key (undefined if no node is highlighted) | - |
|
||||
|
@ -191,6 +191,10 @@ export function useTree(props: TreeProps, emit) {
|
||||
}
|
||||
}
|
||||
|
||||
function setExpendKeys(keys: TreeKey[]) {
|
||||
expandedKeySet.value = new Set(keys)
|
||||
}
|
||||
|
||||
function handleNodeClick(node: TreeNode, e: MouseEvent) {
|
||||
emit(NODE_CLICK, node.data, node, e)
|
||||
handleCurrentChange(node)
|
||||
@ -300,5 +304,6 @@ export function useTree(props: TreeProps, emit) {
|
||||
getNode,
|
||||
expandNode,
|
||||
collapseNode,
|
||||
setExpendKeys,
|
||||
}
|
||||
}
|
||||
|
@ -93,6 +93,7 @@ export default defineComponent({
|
||||
getNode,
|
||||
expandNode,
|
||||
collapseNode,
|
||||
setExpendKeys,
|
||||
} = useTree(props, ctx.emit)
|
||||
|
||||
ctx.expose({
|
||||
@ -110,6 +111,7 @@ export default defineComponent({
|
||||
getNode,
|
||||
expandNode,
|
||||
collapseNode,
|
||||
setExpendKeys,
|
||||
})
|
||||
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user