mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-27 05:00:48 +08:00
28 lines
599 B
JavaScript
28 lines
599 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.contentWrapper
|
|
* $vm.active
|
|
*/
|
|
export default {
|
|
mounted () {
|
|
zIndexManager.registerElement(this.$refs.contentWrapper)
|
|
},
|
|
watch: {
|
|
active (newActive) {
|
|
console.log('[zindexable.watch.active]:', newActive)
|
|
if (newActive) {
|
|
zIndexManager.setNewZIndex(this.$refs.contentWrapper)
|
|
}
|
|
}
|
|
},
|
|
beforeDestroy () {
|
|
zIndexManager.unregisterElement(this.$refs.contentWrapper)
|
|
}
|
|
}
|