0👍
If your images are within the public
folder, you don’t need to use require
since everything in there is bundled automatically.
Try
<v-img v-else :src="`${publicPath}img/uploads/avatars/${cart.avatar}`" />
with
data: () => ({
publicPath: process.env.BASE_URL
})
See https://cli.vuejs.org/guide/html-and-static-assets.html#the-public-folder
0👍
You can also write the path directly if you have imgs on public folder:
<v-avatar class="profile" color="grey" size="164" tile>
<v-img v-if="card.avatar == ''" :src="'/img/profile/stock-1.jpg'"></v-img>
<v-img v-else :src="'/img/uploads/avatars/' + card.avatar"></v-img>
</v-avatar>
- [Vuejs]-How do I initialize VueJs checkbox state from html checked="checked"
- [Vuejs]-Getting custom component prop value in Vue app
Source:stackexchange.com