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

Input event not being emitted #1826

Closed jiwidi closed 3 months ago

jiwidi commented 3 months ago

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

Describe the bug The select is not emitting the input event when options as selected in the select.

I have this vue component:

<template>
    <div>
      <h2>Mount:</h2>
      <v-select
        v-model="selectedMounts"
        :options="mounts"
        multiple
        @input="emitFilter"
        placeholder="Select mount(s)">
      </v-select>
    </div>
  </template>

<script>
import vSelect from "vue-select";

export default {
    components: {
        vSelect
    },
    props: {
        mounts: Array,
    },
    emits: ['updateFilter'],
    data() {
        return {
            selectedMounts: []
        };
    },
    methods: {
        emitFilter() {
            console.log("Input changed")
            this.$emit('updateFilter', this.selectedMounts);
        },
        reset() {
            this.selectedMounts = [];
        }
    }
};
</script>

<style>
@import 'vue-select/dist/vue-select.css';
</style>

Where i expect vue-select to call emitFilter anytime that a new option in the select is adde/removed. But is not being called whatsoever, cant see any logs.

From the documentation I understood this should be the way to code this https://vue-select.org/api/events.html#input. But maybe i'm missing something?

jiwidi commented 3 months ago

Nvm! It was option:selecting that i should be listening to.