[Vuejs]-Vue.js AJAX list rendering check if ready?

1👍

You need to call nextTick right after you set the countries variable. In your callback from the elastic search query it would look like:

this.countries = response.data;
Vue.nextTick(function(){
    //list is rendered
});

nextTick just makes sure the DOM has already responded to the data that has already been updated.

👤Jeff

1👍

Check the Vuejs lyfecycle. You should put your code in the ready() hook, because there you are sure that your component have fully rendered. Now if you are loading data after some event, like mouse click and not in page load, then it should be loaded in the callback of your loading method, then it depends on the library that you are using to load data

Leave a comment