I'm trying to import my images, but i get couldn't find module or failed to load resources. I've used the require function, but it doesn't work too!
`<template>
<div>
<div v-for="product in products" :key="product.id">
<h2>{{ product.title }}</h2>
<img :src="product.link" />
</div>
</div>
</template>
<script>
export default {
data() {
return {
products: [
{
title: "cotton",
link: `./assets/images/cotton.jpg`,
id: 1,
},
{
title: "purse",
link: "./assets/images/purse.jpg",
id: 2,
},
{
title: "leather",
link: "./assets/images/leather.jpg",
id: 3,
},
{
title: "wallet",
link: "./assets/images/wallet.jpg",
id: 4,
},
],
};
},
};
</script>
<style></style>`
images are in the root directory @/assets/images/*.jpg
- I have used require function it didn't work
- tried both absolute and relative path for src attribute