getInfo(){ var that = this let obj = { banner: axios.get(that.url + 'home.php?Action=banner&setaction=banner'), logo: axios.get(that.url + 'home.php?Action=advertising&setaction=logo'), code: axios.get(that.url + 'home.php?Action=advertising&setaction=code'), himg: axios.get(that.url + 'home.php?Action=advertising&setaction=himg'), link: axios.get(that.url + 'home.php?Action=infolist&QType=link'), qq: axios.get(that.url + 'home.php?Action=infocontent&setaction=qq'), mail: axios.get(that.url + 'home.php?Action=infocontent&setaction=mail'), phone: axios.get(that.url + 'home.php?Action=infocontent&setaction=phone'), Hotline: axios.get(that.url + 'home.php?Action=infocontent&setaction=Hotline') } return obj }var that = this axios.all([that.getInfo().banner, that.getInfo().logo, that.getInfo().code, that.getInfo().himg, that.getInfo().link, that.getInfo().qq, that.getInfo().mail, that.getInfo().phone, that.getInfo().Hotline ]) .then(axios.spread(function(banner,logo,code,himg,link,qq,mail,phone,Hotline){ that.banner = banner.data var swiper1 = new Swiper('.banners', { pagination: { el: '.swiper-pagination', }, autoplay: true, speed: 800, observer:true, }); that.logo = logo.data.photo that.code = code.data.photo that.htxtimg = himg.data.photo that.link = link.data that.qq = qq.data.Content console.log(qq); that.mail = mail.data.Content that.phone = phone.data.Content that.Hotline = Hotline.data.Content }))如圖,axios.all()里面有多少個,就會請求少次,不是同時一齊只發(fā)一次...各路大神有沒什么解決方案,或是拆開一個一個發(fā)?
axios.all 并發(fā)多次發(fā)起請求?
一只萌萌小番薯
2019-02-27 18:26:55