I've tried :selected="product.category_id == category.id ? true : false " and have done alot of searching but can't find anything to answer what I thought would be a simple problem
You are missing the value on the option ie :value="category.id" + you are comparing the ID to nothing, so what you are essentially doing is selecting all, in which case the first one will be selected, so you need:
:selected="category.id === categoryId"
Having categoryId in your data object, and pre-selected.
You don’t need to set the selected attribute on the <option> element. It will just auto-select the Id corresponding to the v-model prop that you’ve set at the <select> element.
Hi, i am sorry if it's too late, because i just had this problem too and right now i found the solution myself, so i just gonna put this comment to remind myself in the future, because i can't find any solution in the internet.
i am using VUE 3 btw.
you just need to put v-bind:value="" in the select component :