mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-22 10:30:34 +03:00
fix call stack exceeded
This commit is contained in:
@@ -268,13 +268,14 @@
|
|||||||
*/
|
*/
|
||||||
createOption: {
|
createOption: {
|
||||||
type: Function,
|
type: Function,
|
||||||
default: function (value) {
|
default: function (newOption) {
|
||||||
let firstOption = this.options[0]
|
let value = newOption
|
||||||
|
let firstOption = this.options ? this.options[0] : null
|
||||||
if (firstOption && typeof firstOption === 'object' ) {
|
if (firstOption && typeof firstOption === 'object' ) {
|
||||||
value = {
|
value = {
|
||||||
value
|
value
|
||||||
}
|
}
|
||||||
value[this.label] = value
|
value[this.label] = newOption
|
||||||
}
|
}
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
@@ -294,7 +295,7 @@
|
|||||||
this.onChange && val !== old ? this.onChange(val) : null
|
this.onChange && val !== old ? this.onChange(val) : null
|
||||||
},
|
},
|
||||||
options() {
|
options() {
|
||||||
if (!this.isAdding) {
|
if (!this.taggable) {
|
||||||
this.$set('value', this.multiple ? [] : null)
|
this.$set('value', this.multiple ? [] : null)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -444,11 +445,9 @@
|
|||||||
this.select( this.filteredOptions[ this.typeAheadPointer ] );
|
this.select( this.filteredOptions[ this.typeAheadPointer ] );
|
||||||
} else if (this.taggable && this.search.length){
|
} else if (this.taggable && this.search.length){
|
||||||
let option = this.createOption(this.search)
|
let option = this.createOption(this.search)
|
||||||
this.isAdding = true
|
|
||||||
this.$set('options', [option, ...this.options])
|
this.$set('options', [option, ...this.options])
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.select(option)
|
this.select(option)
|
||||||
this.isAdding = false
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user