Files
heroui-vue/apps/docs/demos/checkbox-controlled.vue
2026-10-22 09:15:27 +08:00

31 lines
715 B
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import {
CheckboxContent,
CheckboxControl,
CheckboxIndicator,
Checkbox,
} from "@heroui-vue/components";
import { ref } from "vue";
const isSelected = ref(true);
</script>
<template>
<div class="flex flex-col gap-3">
<Checkbox
id="email-notifications"
:is-selected="isSelected"
@update:checked="isSelected = $event"
>
<CheckboxContent>
<CheckboxControl>
<CheckboxIndicator />
</CheckboxControl>
邮件通知
</CheckboxContent>
</Checkbox>
<p class="text-sm text-muted">
状态:
<span class="font-medium">{{ isSelected ? "已勾选" : "未勾选" }}</span>
</p>
</div>
</template>