el-carousel在vue项目中使用
<div class="carousel"><el-carousel indicator-position="outside" @change="changeCarousel"><el-carousel-item v-for="(item, index) in images" :key="index"><img class="carousel-img" :
·
<div class="carousel">
<el-carousel indicator-position="outside" @change="changeCarousel">
<el-carousel-item v-for="(item, index) in images" :key="index">
<img class="carousel-img" :src="item.src" />
</el-carousel-item>
</el-carousel>
<div class="carousel-text">
<label>{{ this.labelCh }}</label>
<label>{{ this.labelEn }}</label>
</div>
</div>
// 幻灯片轮播时赋值text
changeCarousel(active, val) {
//active为进入幻灯片的索引值
//val 为离开幻灯片的索引值
console.log("active", active);
console.log("val", val);
this.labelCh = this.texts[active].labelCh;
this.labelEn = this.texts[active].labelEn;
},
更多推荐
已为社区贡献19条内容
所有评论(0)