S
S
Sergey2020-06-12 20:57:21
Vue.js
Sergey, 2020-06-12 20:57:21

How to wait for all child Vue components to load?

There is a parent component Home.vue , child ones are loaded into it in a cycle. I want to organize the loading of the application so that it lasts until the last child component is mounted. How to organize it? Based on the documentation, prescribing $nextTick in the parent's mounted() does not give the desired result, that is, the code works almost immediately, and the final rendering of the page is much later.

mounted() {
  this.$nextTick(() => {
    this.loading = false;
  })
},

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2020-06-12
@Aetae

In fact, all components are mounted when the parent's mounted is fired. If something is not displayed, the question is exclusively in the internal logic of your child components, which means that the solution is not universal, but depends on this logic.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question