我有一个 swiper,可以显示我用数组指定的图片。但是我需要给这些图片添加文字(我需要文字在图片中),但是我无法解决这个问题。也许有人知道如何做到这一点?
HTML
<template>
<div>
<div v-swiper:mySwiper="swiperOption" @someSwiperEvent="callback">
<div class="swiper-wrapper">
<div class="swiper-slide " v-for="banner in banners" :key="banner">
<img :src="getImage(banner)">
</div>
</div>
</div>
</div>
</template>
JS
export default {
data() {
return {
banners: [
'Block1.png' , 'Block2.png' , 'Block3.png' ,'Block4.png'
] ,
words :[
'ABOUT AS' , 'WE OFFER' , 'OUR STAFF' , 'PORTFOLIO'
],
swiperOption: {
slidesPerView: 'auto',
centeredSlides: true,
spaceBetween: -400,
pagination: {
el: '.swiper-pagination',
clickable: true
}
}
}
},
methods : {
getImage(src){
return require(`~/assets/image/banners/${src}` )
},
callback (){
},
addWords(){
},
},
}
Qyouu
相关分类