[Vuejs]-Trying to load data in option of dop downl list in vue js , and fetching data from axios api and in mounted function

0👍

So it’s rendering before the data comes in, and so it isn’t reactive here. You can use this.$forceUpdate() at the end of the async function, or you can set another boolean to trigger start false and flag to true when the async function is complete, then use v-if on the component.

0👍

Are the options supposed to come from model, or are they supposed to come from the component’s data directly? If they’re supposed to come from model then you’ll need to specify model.publisher_array in the option tag, then set model.publisher_array = data (instead of this) when you get the data from the API.

If the array should come from the component’s data directly, then all you have to do is specify an empty publisher_array in data:

data () {
    return {
        publisher_array: [],
        apis: new api(),
        // And so on
    }
}

Leave a comment