关键是设置scroll事件及赋值时要是延迟的,放在$nextTick或setTimeout <scroll-viewclass="scroll_content"scroll-y="true":scrollTop='scrollTop'@scroll='scroll':style="{'top': listTop+'px',height:taskStatus===1?scrollHeight+'px':scrollHeight2+'px'}"><!--任务tab内容--><TaskInfo:taskInfos='...
我的第二个问题就是因为没有设置高度导致 scroll-top不生效,但是设置高度百分之百又满足不了区域滚动,设置百分之分有时还会错位 ---好了不比比,直接上代码,建议全部复制过去 <template> <view class="content flex-column"> <view class="top-view flex-center" @tap="clickEvnet(0)"> 点击我实现滚动到顶...
-- scroll-with-animation="true" 这句话也尽量给加上 --> <scroll-view scroll-y="true" class="msg-list" :style="{ height: clientHeight + 'px' }" scroll-with-animation="true" :scroll-top="scrollTopVal" @scroll="viewScroll"> <view v-for="msg in msgList.data" :key="msg.id"> <...
uniappscroll-viewscroll-top设置不⽣效的解决办法 简直折磨⼈,搜了⼤半早上的⽂档,也没看出来什么眉⽬,看了好多博客,都没啥实质性的⽤处,不说了,直接贴代码 <template> <view> <!-- scroll-with-animation="true" 这句话也尽量给加上 --> <scroll-view scroll-y="true" c...
大概有两种方式,一种是使用 uni.pageScrollTo 方法; 另一种是使用scroll-view 标签的属性:scroll-top(距离值 num) 或 scroll-into-view(子元素的id,不能以数字开头 string); 两种方式的前提是:提供具体的高度值(scroll-view 也可以横向滚动到指定位置)。
scroll-view组件失效可能由多种原因引起。以下是一些常见的排查步骤和解决方案,帮助你解决scroll-view失效的问题: 1. 检查scroll-view组件的使用语法是否正确 确保你的scroll-view组件的语法符合uniapp的规范。例如,正确的使用方式应该类似于: html <scroll-view scroll-y="true" style="height: 300px;"> ...
scroll-view在使用@scroll、@scrolltolower、@scrolltoupper、upper-threshold、lower-threshold ...等熟悉或事件时,不生效,是因为scroll-view没有一个固定的高度,所以需要给容器设定一个高度。 scroll-view开启下拉刷新后,无论在什么位置触摸下滚,都算在进行下拉,这个也是因为没有设置固定高度的问题。 如果...
uni.pageScrollTo失效 前⾔: ⼤概有两种⽅式,⼀种是使⽤ uni.pageScrollTo ⽅法; 另⼀种是使⽤ scroll-view 标签的属性:scroll-top(距离值 num) 或 scroll-into-view(⼦元素的id,不能以数字开头 string); 两种⽅式的前提是:提供具体的⾼度值(scroll-view 也可以横向滚动...
设置一个scrollTop设置竖向滚动条的位置,首先默认为0,当页面向下滚动会触发scroll-top事件从而改变scrollTop的值,当切换到第二个scroll-view时在默认设置scrollTop为0,那么在切换到第二个页面的同时页面的竖向滚动条的位置会默认滚动到最顶部,从而解决了默认滚动到最底部加载多次数据的问题。
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值如scroll...