For some reason my dynamic images wont load. I'm keep getting the error:
Cannot find module '@/assets/images/galery/tn-sm/galery-tn-1-sm.jpg' from '/Users/path/code/ck'
The path is 100% correct, I tried it many times, even without dynamic images it worked. So I don't quite understand what the problem here is.
<template>
<div v-for="img in imgs" :key="img.id">
<img :src="require(`@/assets/images/galery/tn-sm/${img.tn_sm}`)" />
</div>
</template>
<script setup>
const imgs = [
{
id: 0,
url: '',
tn_xl: 'galery-tn-1-xl.jpg',
tn_sm: 'galery-tn-1-sm.jpg'
},
{
id: 1,
url: '',
tn_xl: 'galery-tn-2-xl.jpg',
tn_sm: 'galery-tn-2-sm.jpg'
},
{
id: 2,
url: '',
tn_xl: 'galery-tn-3-xl.jpg',
tn_sm: 'galery-tn-3-sm.jpg'
}
]
</script>
I followed the exact solution as stated here: https://nuxtjs.org/docs/directory-structure/assets/ and tried to put all sorts of characters in front of the url (~/ ../ ./, etc.) Any help would be very appreciated.
Via Active questions tagged javascript - Stack Overflow https://ift.tt/9BNmhcM
Comments
Post a Comment