[Vuejs]-Cannot read property '0' of undefined vue

0👍

I think you just forget to add "v-for" statement.

<div>
    <img v-for="{ id, images } of Products.data"
        :key="`product${id}`"
        :src="'images2/' + images[0].filename"
        width="200"
        height="200"
    >
</div>

The codes above will not render if Products.images is a empty Array.

It will render after the data is fetched.

Leave a comment