2022-07-15 07:23:55 +00:00
|
|
|
<template>
|
|
|
|
<span>
|
|
|
|
<input :checked="checked" type="checkbox" v-bind="$attrs" @input="onInput">
|
2023-11-10 13:16:06 +00:00
|
|
|
<Icon v-if="checked" :icon="faCheck" />
|
2022-07-15 07:23:55 +00:00
|
|
|
</span>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { faCheck } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
const props = withDefaults(defineProps<{ modelValue?: any }>(), {
|
|
|
|
modelValue: false
|
|
|
|
})
|
|
|
|
|
|
|
|
const checked = ref(props.modelValue)
|
|
|
|
|
2022-11-13 15:18:24 +00:00
|
|
|
const emit = defineEmits<{ (e: 'update:modelValue', value: boolean): void }>()
|
2022-07-15 07:23:55 +00:00
|
|
|
|
2022-12-02 16:17:37 +00:00
|
|
|
const onInput = (event: Event) => {
|
2022-07-15 07:23:55 +00:00
|
|
|
checked.value = (event.target as HTMLInputElement).checked
|
|
|
|
emit('update:modelValue', checked.value)
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
span {
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
svg {
|
|
|
|
color: var(--color-highlight);
|
|
|
|
position: absolute;
|
|
|
|
top: 1px;
|
2023-08-20 22:35:58 +00:00
|
|
|
left: 1px;
|
2022-07-15 07:23:55 +00:00
|
|
|
}
|
|
|
|
</style>
|