q***@qq.com
q***@qq.com
  • 发布:2023-11-01 17:01
  • 更新:2024-11-07 10:29
  • 阅读:487

uniapp scroll-view 设置自动滚动 滚动卡死

分类:uni-app

uniapp scroll-view 设置自动滚动 并开启scroll-with-animation后 自动滚动到一定位置后 卡死不在滚动 下附代码 滚动到第九位置就会卡死

<scroll-view scroll-x :scroll-left="data.scrollLeft" @scroll="scroll"  scroll-with-animation='true' >  
            <view class="top10-list">  
                <view class="top10-item" v-for="(item, index) in props.dataList" @click="clickAtIndex(index)">  
                    <view class="order" :class="item.ranking <= 3 ? 'order-top3' : ''">TOP {{item.ranking}}</view>  
                    <!-- <image :src="item.avatar|| '/static/My/ic_default_avatar.png'" mode="aspectFill" class="cover-img"></image> -->  
                    <view  
                        class="cover-img"  
                        style="background-position: top center;background-size: cover;"  
                        :style="{'background-image': 'url(' + (item.avatar || '/static/My/ic_default_avatar-new.png') + ')'}"  
                    ></view>  
                    <view class="name">{{item.userName}}</view>  
                    <view class="credit">{{item.totalScore}}积分</view>  
                </view>  
            </view>  
        </scroll-view>  

data.timer = setInterval(() => {  
                if (props.dataList.length > 4) {  
                    if (data.scrollLeft >= uni.upx2px(224 * (props.dataList.length - 4))) {  
                        data.scrollLeft = uni.upx2px(1)  
                    } else {  
                        data.scrollLeft += uni.upx2px(1)  
                    }  
                }  
            }, 50)
2023-11-01 17:01 负责人:无 分享
已邀请:
看啥呢

看啥呢

咋解决的,也遇到这个问题了

要回复问题请先登录注册