Skip to content

Commit 0030083

Browse files
VdustRmarcosmoura
authored andcommitted
fix(MdChips): make chip allow spaces (vuematerial#1211)
trim input value while inserting fix vuematerial#1207
1 parent e908677 commit 0030083

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/components/MdChips/MdChips.vue

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
<md-input
1818
ref="input"
19-
v-model.trim="inputValue"
19+
v-model="inputValue"
2020
v-if="!mdStatic && modelRespectLimit"
2121
:type="mdInputType"
2222
:id="id"
@@ -69,17 +69,18 @@
6969
}
7070
},
7171
methods: {
72-
insertChip ({ target }) {
72+
insertChip () {
73+
let value = this.inputValue.trim()
7374
if (
74-
!this.inputValue ||
75-
this.value.includes(this.inputValue) ||
75+
!value ||
76+
this.value.includes(value) ||
7677
!this.modelRespectLimit
7778
) {
7879
return
7980
}
80-
this.value.push(this.inputValue)
81+
this.value.push(value)
8182
this.$emit('input', this.value)
82-
this.$emit('md-insert', this.inputValue)
83+
this.$emit('md-insert', value)
8384
this.inputValue = ''
8485
},
8586
removeChip (chip) {

0 commit comments

Comments
 (0)