0👍
✅
There’s no need to add a custom method, you can work with v-model
and the data you already have.
Add a :disabled='modalIU.inpIdSpecialitate === item.inpIdSpecialitate'
on the option with the v-for, so you conditionally disable the option if it is the one currently selected.
You can then remove the v-on:change="disableEnable()"
. Also consider adding a :key
attribute to your v-for for best practice.
1👍
I just created a codesandbox example for this functionality, I added a disabled
property for each option, and on change
event listner, I get the option index, and make it disabled.
https://codesandbox.io/s/elated-smoke-lwcriw?file=/src/components/DisabledOptionOnSelect.vue:351-513
Source:stackexchange.com