I have a requirement to show a spinner in every Vue component.
My initial thought is to use v-if="loading"
within the component's HTML.
How do I know when a component has finished loading? In other words, how can I tell when the DOM has been rendered and data binding is complete?
Based on the Vue lifecycle, the render process is complete when the update
function is triggered.
So, do I really need to implement an update
function in every single component to change the value of loading
to false
? Is there a simpler way to achieve this without extending components or any complex methods?
Ultimately, I would like to have access to this.loading
in the Vue instance.