点击
走马灯跳转对应图片
很简单 只需在 el-carousel绑定一个ref
<template>
<el-carousel :interval="5000" arrow="always" ref="carouse" >
<el-carousel-item v-for="item in 4" :key="item">
<h3>{{ item }}</h3>
</el-carousel-item>
</el-carousel>
</template>
在 methods: 中绑定的事件调用即可
clickIam(index) {
// 更新当前显示的图片索引
console.log(index, "index");
this.$refs.carouse.setActiveItem(index);
},