Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swiper组件开启循环播放,最后一个切换到第一个时不触发onChange事件 #13329

Closed
sjhleo opened this issue Feb 20, 2023 · 8 comments · Fixed by #13388
Closed
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x

Comments

@sjhleo
Copy link
Contributor

sjhleo commented Feb 20, 2023

相关平台

H5

**浏览器版本: chrome 109.0.5414.120 **
使用框架: React

复现步骤

<Swiper
    autoplay
    circular
    indicatorDots
    indicatorColor='#999'
    indicatorActiveColor='#333'
    onChange={this.handlerChange}
>
    {
        ['https://avatars.githubusercontent.com/u/44639576?s=400&u=9228817869693f672f6aa1d75725548855838c6f&v=4', 'https://avatars.githubusercontent.com/u/44639576?s=400&u=9228817869693f672f6aa1d75725548855838c6f&v=4', 'https://avatars.githubusercontent.com/u/44639576?s=400&u=9228817869693f672f6aa1d75725548855838c6f&v=4'].map((item, i) => (
            <SwiperItem key={i}>
                <Image src={item}></Image>
            </SwiperItem>
        ))
    }
</Swiper>

期望结果

循环播放时从最后一个切换到第一个也触发onChange事件

实际结果

循环播放时从最后一个切换到第一个没有触发onChange事件

环境信息

Taro v3.6.0


  Taro CLI 3.6.0 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 14.18.0 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.19 - C:\Users\zoucong\AppData\Roaming\npm\yarn.CMD
      npm: 6.14.15 - C:\Program Files\nodejs\npm.CMD
@taro-bot2 taro-bot2 bot added F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x labels Feb 20, 2023
@jianhao2010303
Copy link

+1

1 similar comment
@lowprofile-isp
Copy link

+1

@smoothdvd
Copy link
Contributor

circular设置成true的时候就会有这个问题,包括设置current的值也是无效的。

@jianhao2010303
Copy link

别沉了,顶起来,这个bug太难了。

@Xiaolong145682
Copy link

v3.6.2版本,rn 端,circular设置成true,初始化的时候展示的是倒数第二个 item,设置 current 都无效!有人遇到类似问题吗

@chanceyliu
Copy link

还没解决吗,自定义面板指示点的时候,需要自己控制current变量,这bug太影响体验了

@jianhao2010303
Copy link

h5端还存在问题。

@toFrankie
Copy link
Contributor

H5 是不是还有问题?设置 circular 和 autoplay 后,从第一项自动切换到最后一项,截止目前是正常的。接着就切换到第一项,没有触发 onChange,并且就此停住了。。。。。。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x
Projects
Archived in project
7 participants