2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-04 06:32:23 +03:00

refactor deselect method (#768)

This commit is contained in:
Jeff Sagal
2019-03-02 14:40:16 -08:00
committed by GitHub
parent dc91310860
commit f95b118edb
+3 -8
View File
@@ -555,14 +555,9 @@
*/
deselect(option) {
if (this.multiple) {
let ref = -1
this.mutableValue.forEach((val) => {
if (val === option || (this.index && val === option[this.index]) || (typeof val === 'object' && val[this.label] === option[this.label])) {
ref = val
}
})
var index = this.mutableValue.indexOf(ref)
this.mutableValue.splice(index, 1)
this.mutableValue = this.mutableValue.filter(val => {
return ! (val === option || (this.index && val === option[this.index]) || (typeof val === 'object' && val[this.label] === option[this.label]));
});
} else {
this.mutableValue = null
}