2019-07-26 16:26:59 +08:00
|
|
|
|
|
|
|
import zIndexManager from '../utils/dom/zIndexManager'
|
|
|
|
|
|
|
|
/**
|
|
|
|
* watch active on component,
|
|
|
|
* acquire new z-index on content when active is set to true
|
|
|
|
*
|
|
|
|
* dependency:
|
2019-08-16 16:45:26 +08:00
|
|
|
* $refs.contentContainer
|
2019-07-26 16:26:59 +08:00
|
|
|
* $vm.active
|
|
|
|
*/
|
|
|
|
export default {
|
|
|
|
mounted () {
|
2019-08-16 16:45:26 +08:00
|
|
|
zIndexManager.registerElement(this.$refs.contentContainer)
|
2019-07-26 16:26:59 +08:00
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
active (newActive) {
|
2019-07-26 16:50:15 +08:00
|
|
|
console.debug('[zindexable.watch.active]:', newActive)
|
2019-07-26 16:26:59 +08:00
|
|
|
if (newActive) {
|
2019-08-16 16:45:26 +08:00
|
|
|
zIndexManager.setNewZIndex(this.$refs.contentContainer)
|
2019-07-26 16:26:59 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
beforeDestroy () {
|
2019-08-16 16:45:26 +08:00
|
|
|
zIndexManager.unregisterElement(this.$refs.contentContainer)
|
2019-07-26 16:26:59 +08:00
|
|
|
}
|
|
|
|
}
|