Vuejs: Callback after render

Neve12ende12 picture Neve12ende12 · Feb 14, 2017 · Viewed 16.2k times · Source

I have a Bootstrap popover that I want to attach to an element that has a conditional render; therefore, I must trigger $().popover() after the element has been attached to the DOM.

Is there a way to trigger a callback after a v-if statement inserts the elements into the DOM?

Answer

Antonio Morales picture Antonio Morales · May 30, 2017

Use this in vuejs 2:

updated: function() {
    $('[data-toggle="tooltip"]').tooltip();
},

take a look here