Axios.all initiates multiple requests concurrently?

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
    }))

as shown in the figure, how many axios.all () there are, there will be fewer requests, not only once at the same time.
are there any solutions for each god, or open one by one?

Mar.02,2021
The purpose of

axios.all () is to send requests in batches, and then execute a unified callback when all requests are returned. It is not to merge all requests into one request to send


requests are sent together in getInfo .


cannot. Because https://github.com/axios/axio.
can be implemented on its own


@ Jon_Li is clearly explained.
you write multiple interfaces and expect axios to merge them for you! The function of the axios library is not clear.


your interface design problem. Axios does not merge requests. It will send as many requests as you have. For browsers, there is a limit to the number of requests that can be made at a time. For ajax, any request will have a waiting process (more or less).

Menu