shentao / vue-multiselect

Universal select/multiselect/tagging component for Vue.js
https://vue-multiselect.js.org/
MIT License
6.72k stars 989 forks source link

Prevent selecting any items when using single select (object) #1484

Open masoud86 opened 3 years ago

masoud86 commented 3 years ago

I'm using Vue-multiselect 2.1.4

It works like a charm when I use single select with array options. But in case of using single select with array of objects, all items are green and they are not selectable! (They have "is-selected" class)

To clarify the problem, I used the sample code from the project website and replace the options with my data.

vue-multiselect-problem

<multiselect v-model="value" deselect-label="Can't remove this value"
    track-by="name" label="name" placeholder="Select one"
    :options="options" :searchable="false" :allow-empty="false">
    <template slot="singleLabel" slot-scope="{ option }">
        <strong>{{ option.name }}</strong> is written in
        <strong>  {{ option.language }}</strong>
    </template>
</multiselect>

const config = {
    data() {
        return {
            value: null,
            options: []
        }
    },
    async mounted() {
        await this.getTerminals();
    },
    methods: {
        async getTerminals() {
            await window.axios.get("/api/Operation/GetTerminals")
                .then(resp => {
                    this.$data.options = resp.data;
                })
                .catch(err => {
                    console.error(err);
                });
            },
    }
};
const app = Vue.createApp(config);
app.component('Multiselect', VueformMultiselect);
app.mount('#app');
NKSosyalMedya commented 3 years ago

Is there anybody could figure out it ?

carmolim commented 3 years ago

I'm using the version 2.2.0 with vue 2.6.11 I copied the example from the website and I'm with the same problem:

Screen Shot 2021-10-14 at 19 45 22

harshuchilzy commented 2 years ago

Same issue here.. Anybody with a solution?

Momenoor commented 2 years ago

The same here, Any solution??

akki-jat commented 2 years ago

@masoud86 Unable to reproduce this in latest version. Please provide reproduction repo.

PH-Vieira commented 11 months ago

I have the same problem