uni.app 下拉刷新

778 阅读1分钟
"enablePullDownRefresh": false,
onPullDownRefresh() {
		  this.getOrderList(this.tabbarIndex)
                  setTimeout(function () {
			  uni.stopPullDownRefresh()
			}, 1000)
		},
		onPageScroll(e){
			
			return;
			//兼容iOS端下拉时顶部漂移
			this.headerPosition = e.scrollTop>=0?"fixed":"absolute";
		},
			// 获取列表
			getOrderList(tbIndex){
				// console.log(tbIndex);
				switch(tbIndex){
					case 0:
						delete this.query.state
						fetchOrderList(1,this.query).then(res=>{
							// console.log(res.records);
							// this.orderList= res.records
							this.list = res.records
							this.total = res.total
							uni.stopPullDownRefresh()
						})
						.catch(() => {
						  uni.stopPullDownRefresh()
						})
					break;
					default:
						this.query.state = tbIndex
						// console.log(this.query);
						fetchOrderList(1,this.query).then(res=>{
							this.list = res.records
							this.total = res.total
							uni.stopPullDownRefresh()
							// this.orderList= res.records
						})
						.catch(() => {
						  uni.stopPullDownRefresh()
						})
				}
			}