2***@qq.com
2***@qq.com
  • 发布:2023-07-01 16:39
  • 更新:2023-07-02 12:52
  • 阅读:294

【报Bug】keep-scroll-position 属性 在数据 unshift 插入数据时 会滚动到顶部

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win10 22621.1848

HBuilderX类型: 正式

HBuilderX版本号: 3.8.4

手机系统: iOS

手机系统版本号: iOS 15

手机厂商: 苹果

手机机型: iphone X

页面类型: nvue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

示例代码:
<list ref="msg-list" class="position-fixed" :style="chatBodyStyle" :show-scrollbar="true" bounce @click="hideAllPopup" v-if="conversation.id && msgList.length"> <refresh @refresh="onrefresh" class="flex justify-center align-center py-20" style="width: 750rpx;"

display="refreshing ? 'show' : 'hide'"> <template v-if="hasMore">
<loading-indicator class="font-gray" style="width: 40rpx; height: 40rpx;"></loading-indicator>
<text class="font-gray font-30 ml-20">{{ refreshing ? '加载中' : '下拉加载更多' }}</text>
</template>
<text v-else class="font-gray font-30">没有更多历史消息</text>
</refresh>

    <cell :keep-scroll-position="true" v-for="(msg, index) in msgList" :key="msg._id" :ref="'msg-' + msg._id">  
        <!-- <view v-if="msgList.length < 5" @appear="loadMore"></view> -->  
        <imMsgItem :msg="msg" :active="msg._id == showMsgById" :aboutMsg="msg.about_msg_id"  
            @retriesSendMsg="retriesSendMsg" @showMsgById="showMsgById" @previewImage="previewImages"  
            @showControl="showControl" @reEdit="reEdit"></imMsgItem>  
    </cell>  
    <!-- <cell v-for="(item,index) in msgList" :key="index">{{ item.body }}</cell> -->  
    <cell ref="chatBodyBottomRef" :recycle="false" :keep-scroll-position="true" :render-reverse-position="true">  
    </cell>  
</list>

操作步骤:

keep-scroll-position 属性 在数据 unshift 插入数据时 会滚动到顶部

预期结果:

应保留位置

实际结果:

滚动位置错误

bug描述:

keep-scroll-position 属性 在数据 unshift 插入数据时 会滚动到顶部

2023-07-01 16:39 负责人:无 分享
已邀请:
喜欢技术的前端

喜欢技术的前端 - QQ---445849201

你这个例子跑不起来,可以提供完整的吗

要回复问题请先登录注册