mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-11-27 04:09:51 +08:00
fix(tree): switcher doesn't trigger expand
This commit is contained in:
parent
22b6046c20
commit
8a4d63a5c6
@ -211,7 +211,7 @@ export default defineComponent({
|
||||
? treeMateRef.value.getNonLeafKeys()
|
||||
: props.defaultExpandedKeys || props.expandedKeys
|
||||
)
|
||||
const controlledExpandedKeysRef = toRef(props, 'selectedKeys')
|
||||
const controlledExpandedKeysRef = toRef(props, 'expandedKeys')
|
||||
const mergedExpandedKeysRef = useMergedState(
|
||||
controlledExpandedKeysRef,
|
||||
uncontrolledExpandedKeysRef
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { h, defineComponent } from 'vue'
|
||||
import { h, defineComponent, PropType } from 'vue'
|
||||
import { SwitcherIcon } from '../../_internal/icons'
|
||||
import { NIconSwitchTransition, NBaseLoading, NBaseIcon } from '../../_internal'
|
||||
|
||||
@ -17,18 +17,7 @@ export default defineComponent({
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
onClick: Function
|
||||
},
|
||||
setup (props) {
|
||||
function doClick (): void {
|
||||
const { onClick } = props
|
||||
if (onClick) onClick()
|
||||
}
|
||||
return {
|
||||
handleClick () {
|
||||
doClick()
|
||||
}
|
||||
}
|
||||
onClick: Function as PropType<(e: MouseEvent) => void>
|
||||
},
|
||||
render () {
|
||||
return (
|
||||
@ -40,7 +29,7 @@ export default defineComponent({
|
||||
'n-tree-node-switcher--hide': this.hide
|
||||
}
|
||||
]}
|
||||
onClick={this.handleClick}
|
||||
onClick={this.onClick}
|
||||
>
|
||||
<div class="n-tree-node-switcher__icon">
|
||||
<NIconSwitchTransition>
|
||||
|
Loading…
Reference in New Issue
Block a user