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()
|
? 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
|
||||||
|
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user