mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-27 05:00:48 +08:00
28 lines
609 B
JavaScript
28 lines
609 B
JavaScript
|
|
import zIndexManager from '../utils/dom/zIndexManager'
|
|
|
|
/**
|
|
* watch active on component,
|
|
* acquire new z-index on content when active is set to true
|
|
*
|
|
* dependency:
|
|
* $refs.contentContainer
|
|
* $vm.active
|
|
*/
|
|
export default {
|
|
mounted () {
|
|
zIndexManager.registerElement(this.$refs.contentContainer)
|
|
},
|
|
watch: {
|
|
active (newActive) {
|
|
console.debug('[zindexable.watch.active]:', newActive)
|
|
if (newActive) {
|
|
zIndexManager.setNewZIndex(this.$refs.contentContainer)
|
|
}
|
|
}
|
|
},
|
|
beforeDestroy () {
|
|
zIndexManager.unregisterElement(this.$refs.contentContainer)
|
|
}
|
|
}
|