Vue-multiselect

Example fiddle for issue reproduction usage

by Damian Dulisz

HTML

<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/vue-multiselect.min.css">
<script src="https://unpkg.com/[email protected]/dist/vue-multiselect.min.js"></script>
<div id="app">
  <multiselect ref="multiselect" v-model="value" :options="options" :close-on-select="false" :clear-on-select="false" :hide-selected="true" :preserve-search="true" placeholder="Pick some" label="name" track-by="name" :preselect-first="true">
  </multiselect>
  <pre class="language-json"><code>{{ value  }}</code></pre>
  <button @click="focusMultiselect">
    Focus Multiselect
  </button>
</div>

CSS

* {
  font-family: 'Lato', 'Avenir', sans-serif;
}

Babel + JSX

new Vue({
	components: {
  	Multiselect: window.VueMultiselect.default
	},
	data: {
  	value: '',
  	options: [
        { name: 'Vue.js', language: 'JavaScript' },
        { name: 'Rails', language: 'Ruby' },
        { name: 'Sinatra', language: 'Ruby' },
        { name: 'Laravel', language: 'PHP', $isDisabled: true }
      ]
	},
  methods: {
  	customLabel (option) {
      return `${option.library} - ${option.language}`
    },
    focusMultiselect () {
    	console.log(this.$refs.multiselect.$el)
    	this.$refs.multiselect.$el.focus()
    }
  }
}).$mount('#app')