11111111111111111111111
vue-select源码仓库:源码仓库
vue-select下载地址:点此下载 点此下载2
vue-select介绍、vue-select使用
A native Vue.js select component that provides similar functionality to Select2 without the overhead of jQuery.
Features
AJAX Support
Tagging
List Filtering/Searching
Supports Vuex
Select Single/Multiple Options
Tested with Bootstrap 3/4, Bulma, Foundation
+95% Test Coverage
~33kb minified with CSS
Zero dependencies
Documentation
Install
Vue Compatibility
vue ~2.0 use vue-select ~2.0
vue ~1.0 use vue-select ~1.0
NPM
Install the package.You should [email protected] use with vue~1.0.
Register the component
import Vue from 'vue'import vSelect from 'vue-select'Vue.component('v-select', vSelect)
You may now use the component in your markup
CDN
Just includevue&vue-select.js- I recommend usingunpkg.
Then register the component in your javascript:
Vue.component('v-select', VueSelect.VueSelect);
You may now use the component in your markup
Here’s anexample on JSBin.
Basic Usage
Syncing a Selected Value
The most common use case forvue-selectis to have the chosen value synced with a parent component.vue-selecttakes advantage of thev-modelsyntax to sync values with a parent.
new Vue({ data: { selected: null }})
Setting Options
vue-selectaccepts arrays of strings and objects to use as options through theoptionsprop.
When provided an array of objects,vue-selectwill display a single value of the object. By default,vue-selectwill look for a key named ‘label’ on the object to use as display text.
License
MIT