mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-15 04:42:23 +08:00
feat(popover): add deactivate method and fix clickoutside handler leak
This commit is contained in:
parent
a2fa6e3b7e
commit
b2db272f20
@ -138,6 +138,13 @@ export default {
|
||||
return style
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
active (newActive) {
|
||||
if (!newActive) {
|
||||
clickoutsideDelegate.unregisterHandler(this.handleClickOutsidePopover)
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.handleMoveOutsidePopover = this.handleMoveOutsidePopover.bind(this)
|
||||
},
|
||||
|
@ -79,6 +79,14 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
deactivate () {
|
||||
this.active = false
|
||||
this.$emit('hide')
|
||||
},
|
||||
activate () {
|
||||
this.active = true
|
||||
this.$emit('show')
|
||||
},
|
||||
handleSetActive (active) {
|
||||
if (active) {
|
||||
if (!this.active) {
|
||||
|
Loading…
Reference in New Issue
Block a user