How does <SwiperSlide/>
know it becomes active?
VUE:
Create or get swiper instanse, then set event listener
this.Swiper = this.$f7.swiper.create('#swiper');
this.Swiper.on('slideChange', () => {
this.slideChange(this.Swiper.activeIndex);
});
Or pass directly callback to params:
<Swiper
params={{
on: {
slideChange: onSwiperSlideChange,
}
}}
>...</Swiper>
function onSwiperSlideChange() {
const swiper = this; // event handler will be bound to swiper instance
console.log(swiper.activeIndex);
}
Yeah, but they are in different files. The slide itself should have a onActivate event. onDeactivate as well. Feature Request.