Answer the question
In order to leave comments, you need to log in
Can't see images in vuetifyjs carousel. How to write paths correctly?
<template>
<v-carousel hide-delimiters>
<v-carousel-item
v-for="(item,i) in items"
:key="i"
:src="item.src"
></v-carousel-item>
</v-carousel>
</template>
<script>
export default {
data () {
return {
items: [
{
src: '@/assets/img1.jpg',
},
{
src: '@/assets/img2.jpg',
},
],
}
},
}
Answer the question
In order to leave comments, you need to log in
The easiest way is to put images in public (or static) and access them from the root /public/img1.jpg
If still relevant, you can try to do this:
import image1 from '../assets/img1.jpg'; // Путь прямой, не через @
import image2 from '../assets/img1.jpg';
export default {
data: () => ({
items: [image1, image2]
})
}
<v-carousel-item
v-for="(item,i) in items"
:key="i"
:src=" `http://***/img${i}.jpg` "
></v-carousel-item>
</v-carousel>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question