2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-16 09:10:33 +03:00

fix call stack exceeded

This commit is contained in:
nanotronic
2016-04-13 20:23:13 +02:00
parent fd3bf874ad
commit f7b24d47e0
+5 -6
View File
@@ -268,13 +268,14 @@
*/
createOption: {
type: Function,
default: function (value) {
let firstOption = this.options[0]
default: function (newOption) {
let value = newOption
let firstOption = this.options ? this.options[0] : null
if (firstOption && typeof firstOption === 'object' ) {
value = {
value
}
value[this.label] = value
value[this.label] = newOption
}
return value
}
@@ -294,7 +295,7 @@
this.onChange && val !== old ? this.onChange(val) : null
},
options() {
if (!this.isAdding) {
if (!this.taggable) {
this.$set('value', this.multiple ? [] : null)
}
},
@@ -444,11 +445,9 @@
this.select( this.filteredOptions[ this.typeAheadPointer ] );
} else if (this.taggable && this.search.length){
let option = this.createOption(this.search)
this.isAdding = true
this.$set('options', [option, ...this.options])
this.$nextTick(() => {
this.select(option)
this.isAdding = false
})
}