2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-05-26 04:34:04 +03:00

multiple mode - add/remove support vuex strictmode (#702)

What
---
- In multiple mode: Update adding or removing a value to use
spread operator or filter, instead of mutating the array directly.

Why
---
So vuex strict mode doesn't throw warnings.
This commit is contained in:
Erik Nygren
2019-02-11 04:06:19 +00:00
committed by Jeff Sagal
parent 182e11b3ea
commit d8635e7ccd
+2 -3
View File
@@ -844,7 +844,7 @@
if (this.multiple && !this.mutableValue) {
this.mutableValue = [option]
} else if (this.multiple) {
this.mutableValue.push(option)
this.mutableValue = [...this.mutableValue, option]
} else {
this.mutableValue = option
}
@@ -867,8 +867,7 @@
ref = val
}
})
var index = this.mutableValue.indexOf(ref)
this.mutableValue.splice(index, 1)
this.mutableValue = this.mutableValue.filter(entry => entry !== ref)
} else {
this.mutableValue = null
}