0

This is the markup for my veu multiselect

and here is the code

<multiselect
   v-model="baths"
   placeholder="Bath"
   track-by="label"    
   label="label"
   :allow-empty="true"
   :options="options.baths"
   :select-label="''"
   :selected-label="''"
   :deselect-label="'Remove'"></multiselect>
1
  • I'd suggest providing a lot more details about your problem, especially the code behind the multiselect component. Commented Aug 15, 2018 at 7:06

1 Answer 1

2

Just populate the baths data property with the data you wanted to be preselected.

data: {
    baths: [],
    options: {
        baths: [
            // baths list here
        ]
    }
},
mounted() {
    this.baths.push(this.options.baths[1]);
}

Also you need to set the multiple prop to true:

<multiselect
   v-model="baths"
   placeholder="Bath"
   track-by="label"    
   label="label"
   :allow-empty="true"
   :options="options.baths"
   :select-label="''"
   :selected-label="''"
   :deselect-label="'Remove'"
   :multiple="true">
</multiselect>

See this example JS Fiddle:

https://jsfiddle.net/0hLexkyz/278/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.