0.0.2 • Published 9 years ago
wtbf-vue-select v0.0.2
NPM
Install the package
$ npm install wtbf-vue-selectRegister the component
import Vue from 'vue'
import vSelect from 'wtbf-vue-select'
Vue.component('v-select', vSelect)You may now use the component in your markup
<v-select v-model="selected" :options="['foo','bar']"></v-select>Basic Usage
Syncing a Selected Value
The most common use case for wtbf-vue-select is to have the chosen value synced with a parent component. wtbf-vue-select takes advantage of the v-model syntax to sync values with a parent.
<v-select v-model="selected"></v-select>new Vue({
data: {
selected: null
}
})Setting Options
wtbf-vue-select accepts arrays of strings and objects to use as options through the options prop.
<v-select :options="['foo','bar']"></v-select>When provided an array of objects, wtbf-vue-select will display a single value of the object. By default, wtbf-vue-select will look for a key named 'label' on the object to use as display text.
<v-select :options="[{label: 'foo', value: 'Foo'}]"></v-select>