mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-22 10:30:34 +03:00
refactor deselect method (#768)
This commit is contained in:
@@ -555,14 +555,9 @@
|
|||||||
*/
|
*/
|
||||||
deselect(option) {
|
deselect(option) {
|
||||||
if (this.multiple) {
|
if (this.multiple) {
|
||||||
let ref = -1
|
this.mutableValue = this.mutableValue.filter(val => {
|
||||||
this.mutableValue.forEach((val) => {
|
return ! (val === option || (this.index && val === option[this.index]) || (typeof val === 'object' && val[this.label] === option[this.label]));
|
||||||
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)
|
|
||||||
} else {
|
} else {
|
||||||
this.mutableValue = null
|
this.mutableValue = null
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user