前端知识学习

可以加入个变量来区分是点击触发的还是自动轮播触发的

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)
      }
    }
  }