[Vuejs]-Problem with using vue.js routing and mixin

0👍

From the reply on your comment I conclude your problem is solved by adding a v-if to your html tag?

Changing your code to

 <img v-if="images[1]" :src="'/' + images[1].img_path" />

should work, as the async. request is probably not resolved by the time, the page is compiled by vue. For that have a look at the vue component lifecycle.

As the data attributes are reactive, your component will be visible and the value within will be updated couple ms later than it is compiled.

I’d be glad if somebody could suggest another approach as do not if this is the best practice myself.

Leave a comment