【小程序】返回顶部wx.pageScrollTo和scroll-view的对比

一、wx.pageScrollTo(https://mp.weixin.qq.com/debug/wxadoc/dev/api/scroll.html)

1. 小程序中双击顶部的textbar。会默认回到顶部

2. 能够触发page的上拉(ReachBottom)和(PullDownRefresh)事件

3. 当页面中有使用position:fixed布局时,弹出键盘时,fixed布局部分和会闪屏

二、scroll-view(https://mp.weixin.qq.com/debug/wxadoc/dev/component/scroll-view.html)

1. 纵向滚动(scroll-y)时,必须设置height值,并且不能使用css忠的calc来计算,scroll-top才能生效

2. 小程序中双击顶部的textbar,无法回到顶部

3. 无法触发page的上拉(ReachBottom)和下拉(PullDownRefresh)事件

4. 当页面中position:fixed布局不受影响