<div class="flex1 flex-col gap20"
style="overflow: auto;padding-top: 20px;"
@scroll="historyScroll">
historyConfig: {
loading: false,
hasMore:true
},
historyScroll(e) {
if(!this.historyConfig.hasMore) return
let chaungKouHeight = e.srcElement.clientHeight
let scrollHeight = e.srcElement.scrollHeight
let scrollTop = e.srcElement.scrollTop
if (scrollTop >= (scrollHeight - chaungKouHeight - 8)) {
this.historyPage.current++
this.loadHistory() //调接口
}
},
async loadHistory(isReset=false) {
if (this.historyConfig.loading) return
this.historyConfig.loading = true
if(isReset){
this.historyPage.current=1
this.historyData=[]
}
let res = await this.getPriceData(this.historyPage,'是')
setTimeout(()=>{
this.historyConfig.loading = false
},200)
if (!res) {
return
}
this.historyConfig.hasMore=res.records.length>0
if (isReset) {
this.historyData = res.records
} else {
this.historyData.push(...res.records)
}
},