关于回调函数的用法之前一直不怎么清楚,半懂不懂的状态,所以在这里记录一下,主要还是怕自己忘记了,
async getGoodList(callBack){
const res = await this.$myRequest({
url: '/api/getgoods?pageindex=' + this.pageindex
})
if(this.pageindex ==1) {
this.goods = res.data.message
}else {
this.goods = [...this.goods, ...res.data.message]
}
// 判断有回调才执行回调函数
callBack && callBack()
}
this.getGoodList(()=>{
uni.stopPullDownRefresh()
})