uniapp vue3版本的scroll-view的scroll-into-view方法不生效解决

问题代码如图

bug原因

建了vue2版本和vue3版本的uniapp分别测试,vue3版本的scroll-view存在scroll-into-view不生效的问题,目前未修复(23.12.20)

已找到解决方法:

scroll-view 里需要设置 :scroll-with-animation="true" (23.12.27)

更优解决办法:(24.04.01)

无须设置:scroll-with-animation="true",只需将scroll-into-view的值改为变量,如:scroll-into-view="scrollPoint"
初始设置 scrollPoint: '',在onMounted里或者页面渲染后,再将scrollPoint设置为对应的id值如scrollPoint='activedVideo'即可。
参考:https://ask.dcloud.net.cn/question/126914
修改方式见下图

其他解决方法,换个思路,如图

思路:获取当前选中元素的left值,并动态绑定给scroll-left实现定位效果

posted @ 2023-12-20 13:30  huihuihero  阅读(719)  评论(0编辑  收藏  举报