支付宝实现效果
![]() |
![]() |
---|
实现思路1
页面加载时获得#rmtj 及#list1~#list5的高度,scrollY默认值为false,当点击tab标签或滚动到特定位置是设置scrollY为true
核心方法
(1) 设置元素id=“rmjt”,获取元素高度
var query = wx.createSelectorQuery();
query.select('#rmtj').boundingClientRect();
query.exec(function (res) {
_this.setData({
res[0].height
});
});`
(2)<scroll-view scroll-y bindscroll="pageScroll" scroll-into-view="{
{container}}">
通过bindscroll监听滚动距离,通过scroll-into-view设置滚动锚点
<