From d8635e7ccdd5f406beb1579c3a8fecae9ffd91e3 Mon Sep 17 00:00:00 2001 From: Erik Nygren Date: Mon, 11 Feb 2019 04:06:19 +0000 Subject: [PATCH] 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. --- src/components/Select.vue | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/Select.vue b/src/components/Select.vue index 5eeff4f..55f770e 100644 --- a/src/components/Select.vue +++ b/src/components/Select.vue @@ -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 }