-
-
Notifications
You must be signed in to change notification settings - Fork 994
Expand file tree
/
Copy pathSingleSelectSearch.vue
More file actions
34 lines (32 loc) · 939 Bytes
/
SingleSelectSearch.vue
File metadata and controls
34 lines (32 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<template>
<div><label class="typo__label">Select with search</label>
<multiselect id="single-select-search" v-model="value" :options="options" :custom-label="nameWithLang" placeholder="Select one" label="name"
track-by="name" aria-label="pick a value"></multiselect>
<pre class="language-json"><code>{{ value }}</code></pre>
</div>
</template>
<script>
import Multiselect from 'vue-multiselect'
export default {
components: {
Multiselect
},
data () {
return {
value: {name: 'Vue.js', language: 'JavaScript'},
options: [
{name: 'Vue.js', language: 'JavaScript'},
{name: 'Rails', language: 'Ruby'},
{name: 'Sinatra', language: 'Ruby'},
{name: 'Laravel', language: 'PHP'},
{name: 'Phoenix', language: 'Elixir'}
]
}
},
methods: {
nameWithLang ({name, language}) {
return `${name} — [${language}]`
}
}
}
</script>