Skip to content

Commit

Permalink
fix(checkbox): add boolean emission prop (#792)
Browse files Browse the repository at this point in the history
  • Loading branch information
2xAA authored Nov 13, 2022
1 parent 57f3658 commit e62f47a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/components/Control.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@
<input type="text" v-model="internalValue" />
</div>
<div class="input" v-else-if="type === 'bool'">
<Checkbox :class="{ light: !inputIsFocused }" v-model="internalValue" />
<Checkbox
:class="{ light: !inputIsFocused }"
v-model="internalValue"
:emitBoolean="true"
/>
</div>
<div class="input" v-else-if="type === 'color'">
<ColorControl
Expand Down
11 changes: 10 additions & 1 deletion src/components/inputs/Checkbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ export default {
allowPartial: {
type: Boolean,
default: false
},
emitBoolean: {
type: Boolean,
default: false
}
},
data() {
Expand Down Expand Up @@ -53,7 +58,11 @@ export default {
value = 0;
}
this.$emit("input", value);
if (this.emitBoolean) {
this.$emit("input", Boolean(value));
} else {
this.$emit("input", value);
}
}
}
};
Expand Down

0 comments on commit e62f47a

Please sign in to comment.