[Vuejs]-Passing object to component using v-for

0๐Ÿ‘

try to change

import component from "src/components/component.vue";

to

import foo from "src/components/component.vue";

on your components section you just call foo instead of foo:component

0๐Ÿ‘

I am not sure, but:

Looks like ${brand} is empty. Your function GetData() is async, so the <foo> is created before the GetData() has its data set/returned.

You can change
<foo v-for="brand in brands" :key="brand.id" :brand="brand"></foo>
To
<foo v-if="brands.length> 0" v-for="brand in brands" :key="brand.id" :brand="brand"></foo>
To make sure that the element is renderd after the data if set.

Note: v-if is when the html is rendered, v-show is just a css display hide, but the html is always renderd

Leave a comment