Refactor code
parent
06812556e1
commit
4c3203b0e0
|
@ -64,7 +64,6 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
let selected = this.isSelected(option);
|
let selected = this.isSelected(option);
|
||||||
|
|
||||||
let optionValue = this.getOptionValue(option);
|
let optionValue = this.getOptionValue(option);
|
||||||
let newValue;
|
let newValue;
|
||||||
|
|
||||||
|
@ -72,7 +71,9 @@ export default {
|
||||||
if (selected) {
|
if (selected) {
|
||||||
newValue = this.d_value.filter((val) => !equals(val, optionValue, this.equalityKey));
|
newValue = this.d_value.filter((val) => !equals(val, optionValue, this.equalityKey));
|
||||||
if (!this.allowEmpty && newValue.length === 0) return;
|
if (!this.allowEmpty && newValue.length === 0) return;
|
||||||
} else newValue = this.d_value ? [...this.d_value, optionValue] : [optionValue];
|
} else {
|
||||||
|
newValue = this.d_value ? [...this.d_value, optionValue] : [optionValue];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (selected && !this.allowEmpty) return;
|
if (selected && !this.allowEmpty) return;
|
||||||
newValue = selected ? null : optionValue;
|
newValue = selected ? null : optionValue;
|
||||||
|
|
Loading…
Reference in New Issue