< scroll-view scroll-y = "true" style = "height: 200px;" bindscrolltoupper = "upper" bindscrolltolower = "lower" bindscroll = "scroll" scroll-into-view = "{{toView}}" scroll-top = "{{scrollTop}}" > < view id = "green" class = "scroll-view-item bc_green" ></ view > < view id = "red" class = "scroll-view-item bc_red" ></ view > < view id = "yellow" class = "scroll-view-item bc_yellow" ></ view > < view id = "blue" class = "scroll-view-item bc_blue" ></ view > </ scroll-view > |
像官方case里面,设置了scrollTop,好像没看到效果
Page({ data: { scrollTop:100, toView: 'green' }) |
在应用里面用到了scrolltop发现无效,跑官方case设了下,发现也这样的?
我尝试“类似返回顶部”的操作,设置scroll-top 对应的变量为0,不生效,需写成this.data.scrollTop - 1。减号后面的数,貌似写成其他大于0的值也可以生效,但是就是不能不写。好奇葩
scroll-into-view的优先级更高,会覆盖scroll-top。