Vue-multiselect
Example fiddle for issue reproduction usage
HTML
<script src="https://unpkg.com/vue-multiselect@2.1.2/dist/vue-multiselect.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/vue-multiselect@2.1.2/dist/vue-multiselect.min.css">
<div id="app">
<multiselect
v-model="taggingSelected"
tag-placeholder="Add this as new tag"
placeholder="Search or add a tag"
label="name"
track-by="code"
:options="taggingOptions"
:multiple="true"
:taggable="true"
@tag="addTag">
</multiselect>
<br/><br/>
<div>
Tag Selected: {{ taggingSelected }}
</div>
</div>
CSS
* {
font-family: 'Lato', 'Avenir', sans-serif;
}
Babel + JSX
new Vue({
components: {
Multiselect: window.VueMultiselect.default
},
data: {
taggingSelected: [],
taggingOptions: [
{ name: "Rock", code: "ro" },
{ name: "Pop", code: "po" },
{ name: "R&B", code: "rb" },
{ name: "Dance", code: "da" }
]
},
methods: {
addTag (newTag) {
const tag = {
name: newTag,
code: newTag.substring(0, 2) + Math.floor((Math.random() * 10000000))
}
this.taggingOptions.push(tag)
this.taggingSelected.push(tag)
}
}
}).$mount('#app')