fix(tree): switcher doesn't trigger expand

This commit is contained in:
07akioni 2021-02-02 23:20:26 +08:00
parent 22b6046c20
commit 8a4d63a5c6
3 changed files with 5 additions and 16 deletions

View File

@ -211,7 +211,7 @@ export default defineComponent({
? treeMateRef.value.getNonLeafKeys() ? treeMateRef.value.getNonLeafKeys()
: props.defaultExpandedKeys || props.expandedKeys : props.defaultExpandedKeys || props.expandedKeys
) )
const controlledExpandedKeysRef = toRef(props, 'selectedKeys') const controlledExpandedKeysRef = toRef(props, 'expandedKeys')
const mergedExpandedKeysRef = useMergedState( const mergedExpandedKeysRef = useMergedState(
controlledExpandedKeysRef, controlledExpandedKeysRef,
uncontrolledExpandedKeysRef uncontrolledExpandedKeysRef

View File

@ -1,4 +1,4 @@
import { h, defineComponent } from 'vue' import { h, defineComponent, PropType } from 'vue'
import { SwitcherIcon } from '../../_internal/icons' import { SwitcherIcon } from '../../_internal/icons'
import { NIconSwitchTransition, NBaseLoading, NBaseIcon } from '../../_internal' import { NIconSwitchTransition, NBaseLoading, NBaseIcon } from '../../_internal'
@ -17,18 +17,7 @@ export default defineComponent({
type: Boolean, type: Boolean,
default: false default: false
}, },
onClick: Function onClick: Function as PropType<(e: MouseEvent) => void>
},
setup (props) {
function doClick (): void {
const { onClick } = props
if (onClick) onClick()
}
return {
handleClick () {
doClick()
}
}
}, },
render () { render () {
return ( return (
@ -40,7 +29,7 @@ export default defineComponent({
'n-tree-node-switcher--hide': this.hide 'n-tree-node-switcher--hide': this.hide
} }
]} ]}
onClick={this.handleClick} onClick={this.onClick}
> >
<div class="n-tree-node-switcher__icon"> <div class="n-tree-node-switcher__icon">
<NIconSwitchTransition> <NIconSwitchTransition>

View File

@ -427,7 +427,7 @@
- [ ] on update value api - [ ] on update value api
- [ ] fix upload dragger - [ ] fix upload dragger
- [x] fix table sorter - [x] fix table sorter
- [ ] tree 多选节点第二个 demo - [x] tree 多选节点第二个 demo
- [ ] table treemate!!! - [ ] table treemate!!!
## Info ## Info