Skip to content

Commit

Permalink
feat: [REQUEST] Q-Chips-Input: Add Duplicate Entry Event or warning #…
Browse files Browse the repository at this point in the history
  • Loading branch information
rstoenescu committed Mar 20, 2018
1 parent 3813f0b commit 6d55b81
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/components/chips-input/QChipsInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,18 @@ export default {
add (value = this.input) {
clearTimeout(this.timer)
this.focus()
if (this.editable && value && !this.model.includes(value)) {
this.model.push(value)
this.$emit('input', this.model)
this.input = ''
if (!this.editable || !value) {
return
}
if (this.model.includes(value)) {
this.$emit('duplicate', value)
return
}
this.model.push(value)
this.$emit('input', this.model)
this.input = ''
},
remove (index) {
clearTimeout(this.timer)
Expand Down

0 comments on commit 6d55b81

Please sign in to comment.