sagalbot / vue-select

Everything you wish the HTML <select> element could do, wrapped up into a lightweight, extensible Vue component.
https://vue-select.org
MIT License
4.62k stars 1.33k forks source link

4.0.0-beta.5 - Deselect button not running option:deselecting event #1747

Open clwilliams8 opened 1 year ago

clwilliams8 commented 1 year ago

Please respect maintainers time by filling in these sections. Your issue will likely be closed without this information.

Describe the bug A clear and concise description of what the bug is.

I'm using these two events on my v-select component: @option:selecting="this.$emit('optionSelecting', $event)" @option:deselecting="this.$emit('optionDeselecting', $event)"

Note that I am emiting because I'm using a wrapper component around v-select called "v-select-container".

In my parent component, I have these the v-select-container and two methods: <v-select-container class="m-0" :selected="data.carrier" :visible="true" ref="carrierInput" data_uri="/api/carrier/paginated" label_column="full_details" @updated="$emit('updateSelectValue', $event, 'carrier.carrier', 'carrier_id')" has_pagination @optionSelecting="optionSelecting" @optionDeselecting="optionDeselecting"

Note that V-select-container is basically just v-select.

The optionSelecting function is working as intended: optionSelecting(option) { console.log('hit optionSelecting'); // once a carrier is selected, set data.carrier_email and data.carrier_phone_number this.data.carrier_email = option.email; this.data.carrier_phone_number = option.phone_number; },

However, this function is not running when I use the Deselect button and I can't figure out why. Is this a bug in the new 4.0 beta version ( Deselect button not emiting option:deselecting ) optionDeselecting(option) { console.log('hit optionDeselecting'); // once a carrier is deselected, clear data.carrier_email and data.carrier_phone_number this.data.carrier_email = ''; this.data.carrier_phone_number = ''; },

Reproduction Link A link to a reproduction of the bug. This is a huge help.

I tried creating a Jsfiddle, but I couldn't find the direct cdn url to include the 4.0 beta version. I tried: https://unpkg.com/vue-select@4.0.0/dist/vue-select.js

Steps To Reproduce Outline the steps to reproduce the bug.

Have a parent component that is importing v-select. The v-select should have this line of code: @option:selecting="optionSelecting" @option:deselecting="optionDeselecting"

When selecting an option, optionSelecting will fire off, but when you using the X button ( Deselect button ), the optionDeselecting function doesn't fire off. Shouldn't Deselect component fire off this event?

Expected behavior A clear and concise description of what you expected to happen.

Screenshots

Screen Shot 2023-01-19 at 3 34 06 PM Screen Shot 2023-01-19 at 3 34 32 PM Screen Shot 2023-01-19 at 3 35 04 PM
iwasherefirst2 commented 1 year ago

I think its a duplicate of https://github.com/sagalbot/vue-select/issues/1430