2020
10-05
10-05
vue基础知识--axios合并请求和slot
一、axios合并请求exportdefault{data(){return{}},created(){functiongetMsg(res1,res2){console.log(res1)console.log(res2)}this.$axios.all([this,axios.post('URL','key=value'),this.axios.get('URL')]).then(this.$axios.spread(getMsg))//分发响应.catch(err=>{console.log(err)})}}这样可以实现发送两个请求,只有所有都成...
继续阅读 >