Skip to content

[组件名称] 是否考虑增加animationfinish的绑定 #3883

@aflyhorse

Description

@aflyhorse

tdesign-miniprogram 版本

1.10.1

重现链接

No response

重现步骤

绑定了bind:change="swiperChange"的轮播图,如果切到后台其他App一段时间(1分钟)又切回,轮播图会疯狂闪屏

参考 https://blog.csdn.net/weixin_34233856/article/details/91400907

部分代码

    <view class="swiper-container">
      <t-swiper
        wx:if="{{swiperImgList && swiperImgList.length > 0}}"
        current="{{current}}"
        autoplay="{{autoplay}}"
        duration="{{duration}}"
        interval="{{interval}}"
        list="{{swiperImgList}}"
        navigation="{{navigation}}"
        bind:change="swiperChange"
        bind:tap="swipClick"
        height="calc((90vw * 9) / 16)"
      />
      <!-- 叠加的白色粗体文字层,内容为当前activity的title -->
      <view class="swiper-overlay-text">{{swiperList[current] && swiperList[current].title}}</view>
      <view wx:if="{{isLoading}}" class="swiper-loading">加载中...</view>
      <view wx:if="{{!swiperList || swiperList.length === 0}}" class="swiper-error">
        轮播图努力加载中,请稍候...
      </view>
    </view>

    swiperChange(e) {
        this.setData({
            current: e.detail.current
        });
    },

    swipClick() {
        const link = this.data.swiperLinks[this.data.current];
        if (link) {
            wx.navigateTo({
                url: `/pages/web-view/web-view?url=${encodeURIComponent(link)}`,
                fail: (err) => console.error('Navigation failed:', err)
            });
        }
    }

期望结果

切屏后回来一切照旧

实际结果

图像左右疯狂抖动且不受控

基础库版本

3.9.1

补充说明

我目前是用

onShow() {
        this.setData({
            autoplay: true
        });
    },

    onHide() {
        this.setData({
            autoplay: false
        });
    },

规避问题,后台时暂停轮播

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionThis is a question, not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions