vue axios 3 的并发请求
vim demon02.vue <template> <div class="home"> </div> </template> <script> import axios from 'axios' export default { name: 'demon02', components: {}, created() { //并发请求:同时进行多个请求,并统一处理返回值 //并发请求的方法: axios.all() axios.spread() axios.all([ axios.get('/data.json'), axios.get('/city.json') ]).then( axios.spread((dataRes,cityRes)=>{ //dataRes,cityRes 可以自定义 console.log(dataRes,cityRes) }) ) } } </script>
一些事情一直在干,说不定以后就结果了呢
本文来自博客园,作者:chenjianwen,转载请注明原文链接:https://www.cnblogs.com/chenjw-note/p/13740847.html

浙公网安备 33010602011771号