axios如何先请求A接口然后在请求B接口

总结:在第一个then的请求结束后,在添加一个then,表示请求第二个接口,在第二个then里面写第二个接口的请求方式

axios.get("./a.json").then(res=>{ //先请求的a接口
                console.log(res)
            }).then(res=>{
                axios.get("./b.json").then(res=>{ //在请求b接口
                    console.log(res)
                })
            }) //这里可以请求c接口
            .catch(err=>{
                console.log(err);
            })

 

相关文章

https://segmentfault.com/a/1190000022018995 https://www....
ES6 (ECMAScript 6)中的模块是一个包含 JavaScript 代码的...
from https://mp.weixin.qq.com/s/-rc1lYYlsfx-wR4mQmIIQQ V...
D:\Temp>npm init vite@latest vue3study --temp...
文章浏览阅读1.2k次。最近自己从零撸起的甘特图组件需要子组...
文章浏览阅读3.3k次,点赞3次,收藏16次。静默打印是什么?简...