准确的说是 防止第一次请求比第二次更晚返回 导致第一次的结果覆盖第二次的结果
data(){
return{
fetchTimes: 0,
}
}
methods:{
async fetchData(params) {
const current = ++this.fetchTimes
const data = await this.fetchApi(params)
if (current !== this.fetchTimes) return
...
}
}