Answer the question
In order to leave comments, you need to log in
How to render components as data is loaded for them?
The situation in a simplified form is as follows: there is a component inside which you need to display two child components and pass the same common parameter to them:
<template>
<section class="section">
<children-1 :some_param="some_param" />
<children-2 :some_param="some_param" />
</section>
</template>
<script>
async mounted() {
const data = await this.getData('/api/endpoint')
this.some_param = data.some_param
},
data() {
return {
some_param: null
}
},
methods: {
getData(url) {
axios.get(url).then(response => response.data)
}
}
</script>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question