nuxt或者vue,axios中如何发送多个请求

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

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

因此正确的使用姿式是采用Promise.all 来发送多个请求. 具体实现请参考以下实现:node

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

相关文章
相关标签/搜索