Skip to content

Commit

Permalink
feat: tree selectedKeys & selectedKeys support .sync modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjinzhou committed Dec 26, 2018
1 parent af361f7 commit 6373ce8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion components/tree/DirectoryTree.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export default {
}
newState._selectedKeys = newSelectedKeys

this.$emit('update:selectedKeys', newSelectedKeys)
this.$emit('select', newSelectedKeys, event)

this.setUncontrolledState(newState)
Expand Down Expand Up @@ -188,7 +189,7 @@ export default {
ref: 'tree',
class: `${prefixCls}-directory`,
on: {
...this.$listeners,
...omit(this.$listeners, ['update:selectedKeys']),
select: this.onSelect,
click: this.onClick,
doubleclick: this.onDoubleClick,
Expand Down
2 changes: 2 additions & 0 deletions components/vc-tree/src/Tree.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ const Tree = {
selectedNodes,
nativeEvent: e,
}
this.__emit('update:selectedKeys', selectedKeys)
this.__emit('select', selectedKeys, eventObj)
},
onNodeCheck (e, treeNode, checked) {
Expand Down Expand Up @@ -516,6 +517,7 @@ const Tree = {
expanded: targetExpanded,
nativeEvent: e,
})
this.__emit('update:expandedKeys', expandedKeys)

// Async Load data
if (targetExpanded && loadData) {
Expand Down

0 comments on commit 6373ce8

Please sign in to comment.