Looking at the element ui marquee document, it is found that there is only the chang event, not the mouse click event
Under the code transformation, add a variable to distinguish whether it is triggered by clicking or triggered by automatic rotation
View demo
html
<el-carousel :interval="3000" arrow="always" trigger='click' @change='swiperchange' @mouseenter.native="isclick = true" @mouseleave.native="isclick = false">
<el-carousel-item v-for="item in 4" :key="item">
<h3>{{ item }}</h3>
</el-carousel-item>
</el-carousel>
js
data() {
return {
isclick: false,
};
},
methods: {
swiperchange(n,o) {
if(this.isclick){
console.log('我是点击触发的'+n)
}
}
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。