feat(popover): add deactivate method and fix clickoutside handler leak

This commit is contained in:
07akioni 2019-08-19 15:24:51 +08:00
parent a2fa6e3b7e
commit b2db272f20
2 changed files with 15 additions and 0 deletions

View File

@ -138,6 +138,13 @@ export default {
return style
}
},
watch: {
active (newActive) {
if (!newActive) {
clickoutsideDelegate.unregisterHandler(this.handleClickOutsidePopover)
}
}
},
created () {
this.handleMoveOutsidePopover = this.handleMoveOutsidePopover.bind(this)
},

View File

@ -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) {