下边我简单的写一下想法function demo(){let data=[];fetch(xxx).then((res)=>{ data.push(res);})return data;}由于是异步请求,所以return的data依然是空数组,而非包含请求数据的数组。那有什么办法在获取数据后再return出去呢? 查看完整描述