[Vuejs]-How to fire ajax requests from multiple Vue components mount() in succession

0👍

✅

mount() is working as it should be. Vue or any other framework shouldn’t consider the fact how many ajax calls you’re making in the process. It’s upto you how you want to design the user experience. From your scenario I can see the following solutions:

  • Take all of the list items ajax call into a single API and load them in your viewModel when the list itself is mounted – rather than loading them individually
  • Make other items disabled of clicking unless the previous API call is completed
  • Create a small plugin that’ll maintain a queue for maintaining these API calls, put a small loader to make the users feel that its in process and that plugin will let component know the returning result

Leave a comment