Answer the question
In order to leave comments, you need to log in
How to organize a poll of dynamically created components through v-for?
Hello, I am creating a list of components like this:
<component :is="feature.class" :key="feature.id" v-for="feature in features"></component>
Answer the question
In order to leave comments, you need to log in
Add ref="features"
to your list, getting data will look something like this:
this.$refs.features.forEach(n => console.log(n.getData()))
IMHO, it's time to switch to the event bus (if the methods are asynchronous - to start polling, and plugin-type components - they themselves implement different methods for obtaining data, well, or the application uses the actor model) or vuex, if the dependencies are somewhat more rigid.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question