mirror of
https://github.com/koel/koel
synced 2024-12-30 06:23:05 +00:00
38 lines
758 B
Vue
38 lines
758 B
Vue
|
<template>
|
||
|
<span>
|
||
|
<input :checked="checked" type="checkbox" v-bind="$attrs" @input="onInput">
|
||
|
<icon :icon="faCheck" v-if="checked"/>
|
||
|
</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)
|
||
|
|
||
|
const emit = defineEmits(['update:modelValue'])
|
||
|
|
||
|
const onInput = (event: InputEvent) => {
|
||
|
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;
|
||
|
left: 2px;
|
||
|
}
|
||
|
</style>
|