Reputation: 217
I'm trying to show multiple images in a slider per page using vuetify as well as Vue-awesome-swiper but doesnot work . Please help me.
<v-sheet class="mx-auto" elevation="8" max-width="100%">
<v-slide-group multiple show-arrows>
<v-slide-item v-for="(n, i) in images" :key="i" v-slot:default="{ active, toggle }">
<v-img :src="n.src" class="ma-4" height="250" width="300"/>
</v-slide-item>
</v-slide-group>
</v-sheet>
data: () => ({
images: [
{ alt: "A kitten", src: "require(`@/assets/images/workplan.jpg`)" },
{ alt: "A kitten", src: "require(`@/assets/images/workplan.jpg`)" },
{ alt: "A kitten", src: "require(`@/assets/images/workplan.jpg`)" },
{ alt: "A kitten", src: "require(`@/assets/images/workplan.jpg`)" }
]
}),
Upvotes: 1
Views: 1109
Reputation: 2134
Here's what I've noticed in your code:
:src="n.src"
and not @src="{{ n.src }}"
. @
is short for v-on
whereas :
is short for v-bind
. What we need is v-bind:src
and there is no such thing as v-on:src
as far as I know.:key
to each <v-slide-item/>
. Avoid using non-primitive value for key.<v-img/>
component over <img/>
tags.Here's a demo.
Upvotes: 2