scroll-view的scroll-y设成false不能取消滚动条
在页面渲染完之后当我点击某个button之后想不让页面(scroll-view)滚动,
此时我把scroll-y设为false之后,页面还是能滚动。
不知是否有其他方案。
代码:
index.js
Page({ data: { windowHeight: 500, scrollY: true }, onLoad() { wx.getSystemInfo({ success: function (res) { this .setData({windowHeight: res.windowHeight}); }.bind( this ) }) }, cancelScroll: function () { this .setData({scrollY: false }); } }) |
index.wxml
< scroll-view style = "height: {{windowHeight}}px;" scroll-y = "{{scrollY}}" > < view >view</ view > < view >view</ view > < view >view</ view >
< view >view</ view > < view >view</ view > < view >view</ view > < button bindtap = "cancelScroll" >取消滚动条</ button > < view >view</ view > < view >view</ view >
< view >view</ view > < view >view</ view > < view >view</ view > </ scroll-view > |
测试手机:小米4(真机与工具都不行)
微信版本:微信6.3.31