Vue-如何使用axios实现同步请求嵌套方法

axios.get('/userAll')
  .then( async response {
    console.log(response);
    //要同步这个方法
    await  axios.get('/user?ID=12345')
      .then(function (response) {
        console.log(response);
      })
      .catch(function (error) {
        console.log(error);
      });
  })
  .catch(function (error) {
    console.log(error);
  });
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐