Skip to content

Weird @change and v-model issue #296

@Not-Net

Description

@Not-Net

Hey, I was trying to build something and I faced a weird issue.
When I add a new tag and i try to access the values in a function that get executed in the @change event. I noticed that the recent added tag is missing.
I created this only to demonstrate the issue!

<template>
    <div class="col-6">
        <label class="form-label mb-1">Values</label>
        <Multiselect            
            mode="tags"
            :caret="false"
            :show-options="false"
            :create-option="true"
            :searchable="true"
            :can-clear="false"
            :object="true"
            v-model="values"
            @change="func"
        />
    </div>
</template>

<script>
import Multiselect from '@vueform/multiselect'

    export default {
        data(){
            return{
                values:[
                    {
                        value:'value1',
                        label:'value1'
                    },
                    {
                        value:'value2',
                        label:'value2'
                    },
                ]
            }
        },
        methods:{
            func(){
                console.log(this.values)
            }
        },
        components:{
            Multiselect
        }
    }
</script>

As you see on the image, when i added a new tag, it don't get printed on the console.
its like the @change event get executed before v-model !

mmultis

How can i access all values in this func() function ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions