mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-19 09:50:33 +03:00
throw console warning if option[label] does not exist, prevents TypeError from breaking page
closes #155
This commit is contained in:
@@ -715,8 +715,10 @@
|
||||
*/
|
||||
filteredOptions() {
|
||||
let options = this.mutableOptions.filter((option) => {
|
||||
if (typeof option === 'object') {
|
||||
if (typeof option === 'object' && option.hasOwnProperty(this.label)) {
|
||||
return option[this.label].toLowerCase().indexOf(this.search.toLowerCase()) > -1
|
||||
} else if (typeof option === 'object' && !option.hasOwnProperty(this.label)) {
|
||||
return console.warn(`[vue-select warn]: Label key "option.${this.label}" does not exist in options object.\nhttp://sagalbot.github.io/vue-select/#ex-labels`)
|
||||
}
|
||||
return option.toLowerCase().indexOf(this.search.toLowerCase()) > -1
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user