1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 import { computed } from 'vue'
import { uniqueId } from 'lodash-es'
export const SwitchInput = ({ modelValue }: { modelValue: boolean }) => {
vineEmits([ 'input', 'update:model-value' ])
const id = computed(() => uniqueId('switch-'))
return vine`
<input
type="checkbox"
role="switch"
:id="id"
:checked="modelValue"
@change="$emit('update:model-value', $event.target.checked)"
>
`
}