vue-select

<p>11111111111111111111111</p>

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 installvue-select@1.3.3for 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

<v-select v-model="selected" :options="['foo','bar']"></v-select>

CDN

Just includevue&vue-select.js- I recommend usingunpkg.

<script src="https://unpkg.com/vue@latest"></script><!-- use the latest release --><script src="https://unpkg.com/vue-select@latest"></script><!-- or point to a specific release --><script src="https://unpkg.com/vue-select@1.3.3"></script>

Then register the component in your javascript:

Vue.component('v-select', VueSelect.VueSelect);

You may now use the component in your markup

<v-select v-model="selected" :options="['foo','bar']"></v-select>

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.

<v-select v-model="selected"></v-select>

new Vue({  data: {    selected: null  }})

Setting Options

vue-selectaccepts arrays of strings and objects to use as options through theoptionsprop.

<v-select :options="['foo','bar']"></v-select>

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.

<v-select :options="[{label: 'foo', value: 'Foo'}]"></v-select>

License

MIT

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容