Skip to content

Commit

Permalink
Don't touch the select original value if options disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
pdanpdan committed Nov 23, 2017
1 parent dbbc3d1 commit a016592
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/components/select/QSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
:class="alignClass"
>
<q-chip
v-for="{label, value} in selectedOptions"
v-for="{label, value, disable: optDisable} in selectedOptions"
:key="label"
small
:closable="!disable"
:closable="!disable && !optDisable"
:color="color"
@click.native.stop
@hide="__toggleMultiple(value)"
@hide="__toggleMultiple(value, disable || optDisable)"
>
{{ label }}
</q-chip>
Expand Down Expand Up @@ -182,7 +182,7 @@ export default {
optModel () {
if (this.multiple) {
return this.value.length > 0
? this.options.map(opt => !opt.disable && this.value.includes(opt.value))
? this.options.map(opt => this.value.includes(opt.value))
: this.options.map(opt => false)
}
},
Expand Down
4 changes: 2 additions & 2 deletions src/mixins/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default {
return this.displayValue
}
if (!this.multiple) {
const opt = this.options.find(opt => (!opt.disable && opt.value === this.value))
const opt = this.options.find(opt => opt.value === this.value)
return opt ? opt.label : ''
}

Expand All @@ -48,7 +48,7 @@ export default {
selectedOptions () {
if (this.multiple) {
return this.length > 0
? this.options.filter(opt => (!opt.disable && this.value.includes(opt.value)))
? this.options.filter(opt => this.value.includes(opt.value))
: []
}
},
Expand Down

0 comments on commit a016592

Please sign in to comment.