How to catch the load event in the markup Vue.js?

I have several blocks
<div v-if="stage == 0">
...
</div>
<div v-else-if="stage == 1">
<div class="elem"></div>
...
</div>

// if some event do:
this.stage = 1;
let elem = document.querySelector('.elem');

The problem is that in this case I get elem is null, because the element not yet in DOM tree. If I initialize it through 100ms (using setTimeout), then everything works fine.
I understand that the setTimeout is a terrible crutch, I would like to catch some built-in Vue.js event download tree. How can I do that?
June 8th 19 at 17:09
1 answer
June 8th 19 at 17:11
Solution
There is a method - $nextTick. It can be used to call the function after updating the DOM tree. Ie, try something like this:
this.stage = 1;
this.$nextTick(() => {
 let elem = document.querySelector('.elem');
...
})

Find more questions by tags JavaScriptVue.js