scroll-view的scrolltop设置太多次后 无法滚动?

小程序 文章 2022-01-25 16:20 383 0 全屏看文

AI助手支持GPT4.0

scroll-view的scrolltop设置太多次后 无法滚动?Can't scroll after scrolltop of scroll-view is set too many times?

scroll-view的scrolltop设置太多次后 无法滚动?

scroll-view的scrolltop设置太多次后 无法滚动

有个需求就是做一个自动轮播的榜单栏 用到的就是不断设置scrolltop的值 但是发现大概设置了上百次后就不会自动滚动了 这是怎么情况

The scrolltop of scroll view cannot be scrolled after being set too many times. There is a need to make an automatic rotation list bar. It is used to continuously set the value of scrolltop, but it is found that it will not scroll automatically after being set hundreds of times. What's the situation

回答:

社区技术运营专员-horanzhou:

请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

独家炒饭:帮忙看一下 谢谢
圣殿骑士:

如果滚动的时候反复去执行

肯定卡死啊,建议setTimeout下,不然内存撑满,IOS会闪退

独家炒饭:setTimeout?
有赞:

几百次的定时任务,去滚动视窗,会有内存溢出的风险,啥需求,能不能考虑其他的方式来实现?

独家炒饭:一个类似广告栏的滚动展示 会有多页
独家炒饭:然后会出现卡顿 一直上下抖动 不会往下滚

-EOF-

AI助手支持GPT4.0