//快速切换头部,列表2的数据,可能会追加到列表1中,列表1的数据没来的及清空。
//头部切换onNavBar(e) {let navIndex = e.detail.setIndex;this.setData({ navIndex, showScreen:false, page: 1, list: [], hasMore:null});this.getOrderList();},//查询用工单审批列表getOrderList() {let reqData = {};let lock =this.data.lock;if(lock) {return;}reqData.page =this.data.page;reqData.status =this.data.navIndex;if(this.data.cdIds) {reqData.cdIds =this.data.cdIds;}this.setData({ pageState:'frame', lock:true})orderModel.getList(reqData).then(res => {const tempArray =this.data.list.concat(res.resultData.records);const dataState = tempArray.length > 0 ?'finish':'empty';this.setData({lock:false,list: tempArray,pageState: dataState,hasMore: res.hasMore})}).catch(err => {this.setData({ pageState:'error', lock:false})})},

大佬们解决了木有~
getOrderList() {
wx.showLoading({
title: '加载中',
mask:true
})
let reqData = {};.....
给getOrderList加一个参数,如果切换了tab就就
const tempArray =res.resultData.records;没切换tab就const tempArray =this.data.list.concat(res.resultData.records);setData完在去请求列表, setData的回调函数 了解一下
恕我愚钝,你这加载的list有区别吗?
使用wx:if试试
不能把list分开么?
是不是onNavBar中this.setData({list:[]})之后加个if判断,判断list为空后再调用就好了