在使用vue或者nuxt中,我们需要使用axios去发送多个http请求,参考了axios的官方说明你也许会想到使用axios.all发送请求,但是这样可能会出现一些异常错误:

(node:9360) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: __WEBPACK_IMPORTED_MODULE_2__plugins_axios__.a.all is not a function

所以正确的使用姿势是采用Promise.all 来发送多个请求. 具体实现请参考如下实现:

Heap Stack Blog(pingbook.top)Nuxt How to send multiple requests in asyncData

相关文章:

  • 2022-02-09
  • 2022-12-23
  • 2021-12-11
  • 2022-12-23
  • 2022-01-13
  • 2022-12-23
  • 2021-07-25
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-23
  • 2021-10-22
  • 2022-01-03
  • 2021-05-28
相关资源
相似解决方案