Skip to content

Commit bf4775f

Browse files
author
Damian Dulisz
committed
Fix shentao#510, Adjust previously mergd fixes
1 parent 08dbd47 commit bf4775f

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

docs/partials/_start.pug

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ section.start(:style="gradient")
1010
a.typo__link(href="http://vuejs.org" target="_BLANK") Vue.js
1111
.badges
1212
img(src="https://img.shields.io/github/stars/monterail/vue-multiselect.svg?label=Stars")
13-
img(src="https://camo.githubusercontent.com/d0e25b09a82bc4bfde9f1e048a092752eebbb4f3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c6174" alt="License" data-canonical-src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat")
14-
img(src="https://camo.githubusercontent.com/64f9a2333bb303d34b1587e1436b24dee6a8e134/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f646d2f7675652d6d756c746973656c6563742e737667" alt="npm" data-canonical-src="https://img.shields.io/npm/dm/vue-multiselect.svg" style="max-width:100%;")
15-
img(src="https://camo.githubusercontent.com/47ff0923e959e736113988e900268dfc7a601d3b/68747470733a2f2f636972636c6563692e636f6d2f67682f6d6f6e74657261696c2f7675652d6d756c746973656c6563742f747265652f6d61737465722e7376673f7374796c653d736869656c6426636972636c652d746f6b656e3d35633933316666323866643132353837363130663833353437326265636464353134643039636566" alt="Build Status" data-canonical-src="https://circleci.com/gh/monterail/vue-multiselect/tree/master.svg?style=shield&circle-token=5c931ff28fd12587610f835472becdd514d09cef" style="max-width:100%;")
16-
img(src="https://camo.githubusercontent.com/51bc9432092f4def26f97d24824c857ad5891c1c/68747470733a2f2f696d672e736869656c64732e696f2f67656d6e617369756d2f6d6f6e74657261696c2f7675652d6d756c746973656c6563742e7376673f7374796c653d666c6174" alt="No Dependencies" data-canonical-src="https://img.shields.io/gemnasium/monterail/vue-multiselect.svg?style=flat" style="max-width:100%;")
13+
img(src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat" alt="License" data-canonical-src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat")
14+
img(src="https://img.shields.io/npm/dm/vue-multiselect.svg" alt="npm" data-canonical-src="https://img.shields.io/npm/dm/vue-multiselect.svg" style="max-width:100%;")
15+
img(src="https://circleci.com/gh/monterail/vue-multiselect/tree/2.0.svg?style=shield&circle-token=5c931ff28fd12587610f835472becdd514d09cef" alt="Build Status" data-canonical-src="https://circleci.com/gh/monterail/vue-multiselect/tree/master.svg?style=shield&circle-token=5c931ff28fd12587610f835472becdd514d09cef" style="max-width:100%;")
16+
img(src="https://img.shields.io/gemnasium/monterail/vue-multiselect.svg?style=flat" alt="No Dependencies" data-canonical-src="https://img.shields.io/gemnasium/monterail/vue-multiselect.svg?style=flat" style="max-width:100%;")
1717
.grid__row.grid__row--centered
1818
.grid__column.grid__unit--md-6
1919
.multiselect-example__container

docs/partials/examples/SingleSelectObject.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ div
99
placeholder="Select one",
1010
:options="options",
1111
:searchable="false",
12-
:allow-empty="true"
12+
:allow-empty="false"
1313
)
1414
pre.language-json
1515
code.

src/Multiselect.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@
5353
<span
5454
v-if="!searchable"
5555
class="multiselect__single"
56-
@mousedown.prevent="toggle()"
56+
@mousedown.prevent="toggle"
5757
v-text="currentOptionLabel">
5858
</span>
5959
</div>
6060
<transition name="multiselect">
6161
<div
6262
class="multiselect__content-wrapper"
6363
v-show="isOpen"
64-
@focus="activate()"
64+
@focus="activate"
6565
@mousedown.prevent
6666
:style="{ maxHeight: optimizedHeight + 'px' }"
6767
ref="list">

src/multiselectMixin.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,13 @@ export default {
221221
default: 'Press enter to create a tag'
222222
},
223223
/**
224-
* Number of allowed selected options. No limit if false.
225-
* @default False
224+
* Number of allowed selected options. No limit if 0.
225+
* @default 0
226226
* @type {Number}
227227
*/
228228
max: {
229-
type: Number
229+
type: [Number, Boolean],
230+
default: false
230231
},
231232
/**
232233
* Will be passed with all events as second param.
@@ -287,6 +288,9 @@ export default {
287288
if (!this.multiple && !this.clearOnSelect) {
288289
console.warn('[Vue-Multiselect warn]: ClearOnSelect and Multiple props can’t be both set to false.')
289290
}
291+
if (!this.multiple && this.max) {
292+
console.warn('[Vue-Multiselect warn]: Max prop should not be used when prop Multiple equals false.')
293+
}
290294
},
291295
computed: {
292296
filteredOptions () {
@@ -335,17 +339,17 @@ export default {
335339
}
336340
},
337341
watch: {
338-
['internalValue'] (newVal, oldVal) {
342+
internalValue (newVal, oldVal) {
339343
/* istanbul ignore else */
340344
if (this.resetAfter && this.internalValue.length) {
341345
this.search = ''
342346
this.internalValue = []
343347
}
344348
},
345-
['search'] () {
349+
search () {
346350
this.$emit('search-change', this.search, this.id)
347351
},
348-
['value'] (value) {
352+
value (value) {
349353
this.internalValue = this.getInternalValue(value)
350354
}
351355
},

0 commit comments

Comments
 (0)