mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-19 09:50:33 +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:
@@ -844,7 +844,7 @@
|
|||||||
if (this.multiple && !this.mutableValue) {
|
if (this.multiple && !this.mutableValue) {
|
||||||
this.mutableValue = [option]
|
this.mutableValue = [option]
|
||||||
} else if (this.multiple) {
|
} else if (this.multiple) {
|
||||||
this.mutableValue.push(option)
|
this.mutableValue = [...this.mutableValue, option]
|
||||||
} else {
|
} else {
|
||||||
this.mutableValue = option
|
this.mutableValue = option
|
||||||
}
|
}
|
||||||
@@ -867,8 +867,7 @@
|
|||||||
ref = val
|
ref = val
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
var index = this.mutableValue.indexOf(ref)
|
this.mutableValue = this.mutableValue.filter(entry => entry !== ref)
|
||||||
this.mutableValue.splice(index, 1)
|
|
||||||
} else {
|
} else {
|
||||||
this.mutableValue = null
|
this.mutableValue = null
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user