How to determine how to hide a page when both ajax return results in vue

enter a page with loading. When both ajax returns results, the loading is hidden. How can you tell that both ajax have returned results?
because they are both asynchronous, one may return, and the other will return after a period of time. You can"t poll the results of two ajax all the time, can you?

Jan.10,2022

axios.all([
    axios.get('xxxxxx'),
     axios.get('xxxxx')
]).then(axios.spread((response1,response2)=>{
 // 
}));

when all requests are completed, you will receive an array containing response objects in the same order as the requests were sent


  1. A simple method to string two requests together (after the first request is completed, the second is sent, and the second is completed, which means that all requests are finished)
  2. wrap the request as a Promise object, and then use Promise.all, to send the request in parallel. You can also get the
  3. you want.
Menu