1、需要在
pages.json
里,找到的當前頁面的pages節點,並在 style 選項中開啟
enablePullDownRefresh
。

2、當處理完數據刷新后,
uni.stopPullDownRefresh
可以停止當前頁面的下拉刷新。
onPullDownRefresh
在js中定義onPullDownRefresh處理函數(和onLoad等生命周期函數同級),監聽該頁面用戶切換刷新事件。

this.pendingList()用來請求數據的
// 待處理列表 pendingList() { // uni.showLoading({ // title: "提交中", // mask: true // }) this.http .request({ method: 'GET', url: ' center.Pending/list', data: { // 請求參數 type: this.tab_list[this.tab_index].status } }) .then(res => { console.log(res); uni.hideLoading() if (res.data.code == 1) { uni.stopPullDownRefresh(); this.list = this.list.concat(res.data.data); console.log(this.list) // this.list.map(function(item,index){ // return this.apply_id = item.id // }) // console.log(this.apply_id) } else { uni.showToast({ icon: "none", title: res.data.msg, duration: 2000 }); } }) .catch(e => { // this.mescroll.endSuccess(0); uni.hideLoading() }); },
參考文檔
https://www.jianshu.com/p/eb24c489027a
https://uniapp.dcloud.io/api/ui/pulldown?id=onpulldownrefresh