Skip to content

Commit

Permalink
Merge pull request #40 from DWYW/select
Browse files Browse the repository at this point in the history
fix the exception when the select option does not exist
  • Loading branch information
DWYW authored Dec 20, 2020
2 parents b5e6b41 + f3ed504 commit a6e97fb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/select/_src/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export default {
// if the search function be used and nothing selected, to restore the label.
if (this.value && !this.values.find(item => item && item[1] === this.keyword)) {
this.keyword = this.values[0][1]
this.keyword = helpers.getValueByPath(this.values, '[0][1]', '')
}
}
Expand Down Expand Up @@ -250,7 +250,8 @@ export default {
return acc
}, [])
this.updateSelected(values)
// If value is defined and can not find in options, emit events.
this.updateSelected(values, values.length === 0 && this.value)
},
removeSelectedItem (index) {
Expand Down

0 comments on commit a6e97fb

Please sign in to comment.