[Vuejs]-Vue trigger mounted before async created completed

0👍

The mounted method will not wait untill the created method is done (event if its async) instead what you could do is create a different function and call this at the end of your create function

this will look something like this:

 async created() {
   
   this.cakeShops = await this.fetchCakeShops({page: 1})
   
   this.loaded();
 },

 methods: {
   loaded: {
     //code here
   },
 }

Leave a comment