Skip to content

Commit

Permalink
Update Checkbox.vue (snapshot-labs#1496)
Browse files Browse the repository at this point in the history
  • Loading branch information
mktcode authored Jan 22, 2022
1 parent b540546 commit 0611ade
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/components/Checkbox.vue
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
<script setup>
import { ref } from 'vue';
const props = defineProps({
modelValue: Boolean
});
const emit = defineEmits(['update:modelValue']);
const input = ref(false);
function handleToggle() {
input.value = !input.value;
emit('update:modelValue', input.value);
emit('update:modelValue', !props.modelValue);
}
if (props.modelValue) input.value = props.modelValue.toString();
</script>

<template>
<a @click="handleToggle">
<Icon
:name="input ? 'toggle-on' : 'toggle_off'"
:class="input ? 'text-green' : 'border-color'"
:name="modelValue ? 'toggle-on' : 'toggle_off'"
:class="modelValue ? 'text-green' : 'border-color'"
size="32"
/>
</a>
Expand Down

0 comments on commit 0611ade

Please sign in to comment.