Skip to content

Commit

Permalink
fix: clear selected value when value comes empty
Browse files Browse the repository at this point in the history
  • Loading branch information
hcarmonas committed Jun 6, 2022
1 parent aa99b23 commit 95cdfe8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/SelectInput/SelectInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,12 @@ export default {
},
value() {
this.assignSelectedFromOptions();
const action = [
this.assignSelectedFromOptions,
() => (this.selected = null),
][Number(!this.value)];
action();
},
},
Expand Down Expand Up @@ -229,7 +234,7 @@ export default {
const selectedValue = this.options.find(
(item) => item.value === this.value,
);
this.selected = { name: '', value: '' };
if (selectedValue) this.selected = selectedValue;
},
},
Expand Down

0 comments on commit 95cdfe8

Please sign in to comment.