You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Swiper循环回到首张幻灯片时点击事件失效问题求助

Swiper循环切换时点击事件失效问题

当Swiper循环回到首张幻灯片时,点击事件无法正常触发,点击处理函数在以下场景中失效:

  • 从最后一张幻灯片< 4/4 >点击>箭头时
  • 从第一张幻灯片< 1/4 >点击<箭头时

Swiper循环切换点击失效演示


参考代码片段

mounted(): void {
  new Swiper(this.$refs.swiper, {
    modules: [Navigation, Pagination, Autoplay],

    // SwiperOptions
    loop: true,
    loopFillGroupWithBlank: true,
    autoplay: {
      delay: 4 * SECOND,
      disableOnInteraction: false,
    },
    speed: SECOND / 2,
    observer: true,
    observeParents: true,
    parallax: true,
    preventClicks: false,
    preventClicksPropagation: false,
    centeredSlides: true,
    slideToClickedSlide: true,

    navigation: {
      nextEl: '.swiper-button-next',
      prevEl: '.swiper-button-prev',
    },
    pagination: {
      el: '.swiper-pagination',
      clickable: true,
    },

    on: {
      slideChange: (swiper) => {
        this.activeIndex = swiper.realIndex
      },
      touchEnd: (swiper) => {
        this.activeIndex = swiper.realIndex
      },
    },
  })
}

已在网上搜索相关解决方案但未找到有效办法,恳请协助解决。

内容的提问来源于stack exchange,提问作者Penny Liu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 10:17:09