Refactor Switch component to use model binding

This commit is contained in:
Land 2025-11-02 13:18:11 +05:30 committed by GitHub
parent dab0557c99
commit 7f09a9d148
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,11 +2,11 @@
import { Switch } from '@headlessui/vue'
import { ref } from 'vue'
const enabled = defineModel({ default: false })
const model = defineModel()
</script>
<template>
<Switch v-model="enabled" class="switch" :class="{ enabled }">
<Switch v-model="model" class="switch" :class="{ enabled: model }">
<span class="thumb" />
</Switch>
</template>