1
1
# vue-select [ ![ Build Status] ( https://travis-ci.org/sagalbot/vue-select.svg?branch=master )] ( https://travis-ci.org/sagalbot/vue-select ) [ ![ Code Coverage] ( https://img.shields.io/codeclimate/coverage/github/sagalbot/vue-select.svg?style=flat-square )] ( https://codeclimate.com/github/sagalbot/vue-select ) [ ![ No Dependencies] ( https://img.shields.io/gemnasium/sagalbot/vue-select.svg?style=flat-square )] ( https://gemnasium.com/github.com/sagalbot/vue-select ) ![ MIT License] ( https://img.shields.io/github/license/sagalbot/vue-select.svg?style=flat-square ) ![ Current Release] ( https://img.shields.io/github/release/sagalbot/vue-select.svg?style=flat-square )
2
2
3
- > A native Vue.js component that provides similar functionality to Select2 without the overhead of jQuery.
4
-
5
- Rather than bringing in jQuery just to use Select2 or Chosen, this Vue.js component provides similar functionality without the extra overhead of jQuery, while providing the same awesome data-binding features you expect from Vue. Vue-select has no JavaScript dependencies other than Vue, and is designed to mimic [ Select2] ( https://github.com/select2/select2 ) .
6
-
3
+ > A native Vue.js select component that provides similar functionality to Select2 without the overhead of jQuery.
7
4
8
5
#### Features
9
-
10
- - ** AJAX Support +v1.2.0**
11
- - Tagging Support ** +v.1.1.0**
12
- - No JS Dependencies
6
+ - AJAX Support
7
+ - Tagging
13
8
- List Filtering/Searching
14
9
- Supports Vuex
15
10
- Select Single/Multiple Options
16
11
- Bootstrap Friendly Markup
17
12
- +95% Test Coverage
18
13
19
- #### Upcoming/In Progress
14
+ ## Documentation
15
+ - ** [ Demo & Docs] ( http://sagalbot.github.io/vue-select/ ) **
16
+ - ** [ Example on JSBin] ( http://jsbin.com/saxaru/5/edit?html,js,output ) **
20
17
21
- - ~~ Tagging (adding options not present in list, see ` taggable ` branch)~~ ** +v.1.1.0**
22
- - ~~ Asyncronous Option Loading~~ ** +v.1.2.0**
23
- - Rich Option Templating
18
+ ## Install & Basic Usage
24
19
25
- ## Live Examples & Docs
26
- - [ Demo & Docs ] ( http://sagalbot.github.io/ vue-select/ )
27
- - [ Live Example on JSBin ] ( http://jsbin.com/saxaru/5/edit?html,js,output )
20
+ #### Vue Compatability
21
+ - ` vue-select ~2.0 ` is compatible with ` vue ~2.0 `
22
+ - ` vue-select ~1.0 ` is compatible with ` vue ~1.0 `
28
23
29
- ## Install / Usage
24
+ #### NPM
30
25
31
- #### NPM Based WorkFlows
32
- ``` bash
26
+ ``` bash
33
27
$ npm install vue-select
34
28
```
35
29
36
30
``` html
37
31
<template >
38
- <div id = " myApp " >
39
- <v-select :value.sync = " selected " :options =" options" ></v-select >
32
+ <div >
33
+ <v-select v-model = " select " :options =" options" ></v-select >
40
34
</div >
41
35
</template >
42
36
@@ -54,17 +48,15 @@ export default {
54
48
</script >
55
49
```
56
50
57
- #### Browser Globals
58
-
59
- ` v1.3.0+ ` no longer requires any toolchain to use the component:
51
+ #### CDN/Browser Globals
60
52
61
- Just include ` vue ` & ` vue-select.js ` - I recommend using [ npmcdn ] ( https://npmcdn .com/#/ ) .
53
+ Just include ` vue ` & ` vue-select.js ` - I recommend using [ unpkg ] ( https://unpkg .com/#/ ) .
62
54
63
55
``` html
64
56
<!-- use the latest release -->
65
- <script src =" https://npmcdn .com/vue-select@latest" ></script >
57
+ <script src =" https://unpkg .com/vue-select@latest" ></script >
66
58
<!-- or point to a specific release -->
67
- <script src =" https://npmcdn .com/vue-select@1.30 " ></script >
59
+ <script src =" https://unpkg .com/vue-select@1.3.3 " ></script >
68
60
```
69
61
Then register the component in your javascript:
70
62
@@ -74,156 +66,4 @@ Vue.component('v-select', VueSelect.VueSelect);
74
66
75
67
From there you can use as normal. Here's an [ example on JSBin] ( http://jsbin.com/saxaru/5/edit?html,js,output ) .
76
68
77
- ## Parameters
78
- ``` javascript
79
- /**
80
- * Contains the currently selected value. Very similar to a
81
- * `value` attribute on an <input>. In most cases, you'll want
82
- * to set this as a two-way binding, using :value.sync. However,
83
- * this will not work with Vuex, in which case you'll need to use
84
- * the onChange callback property.
85
- * @type {Object||String||null}
86
- */
87
- value: {
88
- default: null
89
- },
90
-
91
- /**
92
- * An array of strings or objects to be used as dropdown choices.
93
- * If you are using an array of objects, vue-select will look for
94
- * a `label` key (ex. [{label: 'This is Foo', value: 'foo'}]). A
95
- * custom label key can be set with the `label` prop.
96
- * @type {Object}
97
- */
98
- options: {
99
- type: Array ,
100
- default () { return [] },
101
- },
102
-
103
- /**
104
- * Sets the max-height property on the dropdown list.
105
- * @deprecated
106
- * @type {String}
107
- */
108
- maxHeight: {
109
- type: String ,
110
- default: ' 400px'
111
- },
112
-
113
- /**
114
- * Enable/disable filtering the options.
115
- * @type {Boolean}
116
- */
117
- searchable: {
118
- type: Boolean ,
119
- default: true
120
- },
121
-
122
- /**
123
- * Equivalent to the `multiple` attribute on a `<select>` input.
124
- * @type {Object}
125
- */
126
- multiple: {
127
- type: Boolean ,
128
- default: false
129
- },
130
-
131
- /**
132
- * Equivalent to the `placeholder` attribute on an `<input>`.
133
- * @type {Object}
134
- */
135
- placeholder: {
136
- type: String ,
137
- default: ' '
138
- },
139
-
140
- /**
141
- * Sets a Vue transition property on the `.dropdown-menu`. vue-select
142
- * does not include CSS for transitions, you'll need to add them yourself.
143
- * @type {String}
144
- */
145
- transition: {
146
- type: String ,
147
- default: ' expand'
148
- },
149
-
150
- /**
151
- * Enables/disables clearing the search text when an option is selected.
152
- * @type {Boolean}
153
- */
154
- clearSearchOnSelect: {
155
- type: Boolean ,
156
- default: true
157
- },
158
-
159
- /**
160
- * Tells vue-select what key to use when generating option
161
- * labels when each `option` is an object.
162
- * @type {String}
163
- */
164
- label: {
165
- type: String ,
166
- default: ' label'
167
- },
168
-
169
- /**
170
- * An optional callback function that is called each time the selected
171
- * value(s) change. When integrating with Vuex, use this callback to trigger
172
- * an action, rather than using :value.sync to retreive the selected value.
173
- * @type {Function}
174
- * @default {null}
175
- */
176
- onChange: Function ,
177
-
178
- /**
179
- * Enable/disable creating options from searchInput.
180
- * @type {Boolean}
181
- */
182
- taggable: {
183
- type: Boolean ,
184
- default: false
185
- },
186
-
187
- /**
188
- * When true, newly created tags will be added to
189
- * the options list.
190
- * @type {Boolean}
191
- */
192
- pushTags: {
193
- type: Boolean ,
194
- default: false
195
- },
196
-
197
- /**
198
- * User defined function for adding Options
199
- * @type {Function}
200
- */
201
- createOption: {
202
- type: Function ,
203
- default : function (newOption ) {
204
- if (typeof this .options [0 ] === ' object' ) {
205
- return {[this .label ]: newOption}
206
- }
207
- return newOption
208
- }
209
- }
210
- ```
211
-
212
-
213
- ## Build Setup for Contributing
214
-
215
- If there's a feature you'd like to see or you find a bug, feel free to fork and submit a PR. If your adding functionality, add tests to go with it.
216
-
217
- ``` bash
218
- # install dependencies
219
- npm install
220
-
221
- # serve with hot reload at localhost:8080
222
- npm run dev
223
-
224
- # run unit tests
225
- npm test
226
-
227
- # run unit tests on save
228
- npm run test-watch
229
- ```
69
+ ### For more information, please visit the [ vue-select documentation.] ( https://sagalbot.github.io/vue-select )
0 commit comments