0👍
Walking through your code, :get-option-label
calls the method onSetOptionLabel()
. This method emits an event containing the option
value.
Your parent component captures the event and calls updateItemLabel
method passing in that same option
value. This parent method performs some logic and returns a value… where is the value returned? It’s not to the v-select, that’s down in the child component. The answer is nowhere.
There are a few ways you could solve your problem but in my opinion you should pass down this.lists.items
to DropdownItem.vue as an additional prop and perform all the necessary label logic within that component to keep things as simple as possible. Whatever method you assign to get-option-label
, that’s the method that needs to return a value for the labels to be set. So put all necessary logic in that onSetOptionLabel
method and remove the emit.