axios合并异步请求
onMounted(()=>{//axios合并异步请求axios.all([getTypeData(),getArticleList()]).then(axios.spread((typeListRes,articleListRes)=>{console.log(typeListRes.data,articleListRes.data);}))})const typeLi.
·
onMounted(()=>{
//axios合并异步请求
axios.all([getTypeData(),getArticleList()])
.then(axios.spread((typeListRes,articleListRes)=>{
console.log(typeListRes.data,articleListRes.data);
}))
})
const typeList=ref([]);
const articleList=ref([]);
const getTypeData=()=>{
return axios({
url:`${baseURL}/getTypeList`,
method:"get"
})
}
const getArticleList=()=>{
return axios({
url:`${baseURL}/getArticleList`,
method:"get"
})
}
更多推荐
已为社区贡献3条内容
所有评论(0)