参考文档:https://taro-docs.jd.com/taro/docs/tutorial#%E9%A1%B9%E7%9B%AE%E7%9B%AE%E5%BD%95%E7%BB%93%E6%9E%84
其实和微信小程序一样,只要设置页面配置信息并添加对应函数即可
class Index extends Component {
// 添加小程序页面配置信息
config: {
enablePullDownRefresh: true,
onReachBottomDistance: 50
}
onPullDownRefresh() {
console.log('下拉刷新')
setTimeout(() => {
// 停止下拉刷新
Taro.stopPullDownRefresh()
}, 1000)
}
onReachBottom() {
console.log('触底事件,做上拉加载')
}
}