Answer the question
In order to leave comments, you need to log in
Hang a handler on a hidden element?
Good evening.
There is a hidden v-if block (I can't use v-show here). It has an element with a tooltip from materializecss. Because element hidden on load tooltip doesn't work. There is a method that changes the visibility of the block, but the tooltip initialization does not work in it...
active(el){
this.viz=true
M.Tooltip.init( this.$refs.el, {enterDelay: 400})
}
Answer the question
In order to leave comments, you need to log in
There are many ways to do this with different nastiness, but the correct method is to make a wrapper component, which will hang all the necessary functionality inside itself.
The most primitive example:
Vue.component('m-tooltip', {
mounted() {
const tooltip = M.Tooltip.init(this.$el, {enterDelay: 400});
this.$once('hook:beforeDestroy', () => tooltip.destroy());
},
render() {
return this.$slots.default
}
})
If you need something more - you can always complicate.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question