loadHotListFromTab 不能理解
来源:5-25 List 组件 - 根据 tab 的切换,获取真实数据

2019移动互联公用号
2022-07-15
async loadHotListFromTab(){
if(!this.listData[this.currentIndex]){
this.isLoading=true;
const id = this.tabData[this.currentIndex].id
this.listData[this.currentIndex]= await getHotListFromTabType(id).data.list;
const id = this.tabData[this.currentIndex].id;
const { data: res } = await getHotListFromTabType(id);
this.listData[this.currentIndex] = res.list;
this.isLoading=false;
}
else{
this.isLoading=false;
}
}
为什么我自己写的不行 看按照老师的 确实行的通 的
有点不是很能理解
我自己写的 并不会进行存储 loading 一直存在
修改成老师的 一切bug 都没了
写回答
2回答
-
Sunday
2022-07-15
你好
这两块逻辑从代码中并没有什么区别,是一个意思,只不过是第二块多了一个 A 而已。你的意思是其中有一段代码是会出错误的嘛?
022022-07-15 -
2019移动互联公用号
提问者
2022-07-15
而且是可以接收到 数据的 code :200
00
相似问题