[Vuejs]-Getting my vue select to display the correct option

0👍

In order to solve my problem this is what I did.

I changed

    data(){
        return {
            categories: [],
            categorySelect: null
        }
    },

to

    data(){
        return {
            categories: [],
            categorySelect: this.product[0]['category_id'],
        }
    },

and I removed :selected="category.id === product[0]['category_id']"

Leave a comment