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

31 lines
715 B
Vue
Raw 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 { ref } from "vue";
import {
Checkbox,
CheckboxContent,
CheckboxControl,
CheckboxIndicator,
Description,
} from "@heroui-vue/components";
const isIndeterminate = ref(true),
isSelected = ref(false);
function update(value: boolean) {
isSelected.value = value;
isIndeterminate.value = false;
}
</script>
<template>
<Checkbox
id="select-all"
:is-indeterminate="isIndeterminate"
:checked="isSelected"
@update:checked="update"
>
<CheckboxContent>
<CheckboxControl><CheckboxIndicator /></CheckboxControl>
全选
</CheckboxContent>
<Description>展示部分选中状态(短横线图标)</Description>
</Checkbox>
</template>