swiper的普通点击事件不管用,需要单独重写
1、swiperOption
swiperOption: {
loop: false,
slidesPerView: '3',
spaceBetween: 24,
centeredSlides: false,
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev'
},
on: {
click: function() {
// 这里的this表示swiper
vm.handleDetailClick(this.realIndex)
}
}
}
2、
created() {
vm = this
},
methods: {
handleDetailClick(index) {
let id = this.teamList[index].id
this.$emit('enterTeamDetail', id)
}
}