<scroll-view style="width:100%;height:{{windowHeight}}px" scroll-y="true" scroll-into-view="{{bottomId}}"
scroll-with-animation="true">
<view id="bottomView" ></view>
·<view id="bottomView2" ></view>
</scroll-view>
注意里面的 scroll-into-view="{{bottomId}}" 和 id=“bottomView” 属性。
/**
* 页面的初始数据
*/
data: {
bottomId: null,
},
........
/**
* 滚动到指定位置
*/
scrollBottom: function () {
var that = this;
that.setData({
bottomId: 'bottomView',
})
}
bottomId 和scroll-view 组件中元素的ID相同时 界面将自动滚动到此位置