benjackson
1 year ago
179
2
Vue

How to push a component onto list of dynamic components

Posted 1 year ago by benjackson

I have a set of items which I'm displaying in a v-for list, and each list item is a component.

<component v-for="(item, index) in feed"
                        :is="item.type"
                        v-bind:data="item"
                        v-bind:list="list"
                        v-bind:index="index"
                        v-bind:key="item.id"></component>

Another component on the page has an event listener waiting for some user input. Is there a way I can take the data, push it into my array of items, and have it new up the vue component?

Something like:

this.feed.push(new Component(data) )

but in a Vuejs friendly way?

Please sign in or create an account to participate in this conversation.