Files
heroui-vue/apps/docs/demos/handbook-states.vue
T

34 lines
914 B
Vue

<script setup lang="ts">
import { ref } from "vue";
import { Button } from "@heroui-vue/components";
const pending = ref(false);
</script>
<template>
<div class="flex flex-wrap items-center gap-3">
<Button as-child v-slot="{ isPressed, isHovered, isFocusVisible }">
<button class="handbook-state-button">
{{
isPressed
? "按下中"
: isHovered
? "悬停中"
: isFocusVisible
? "键盘焦点"
: "与我交互"
}}
</button>
</Button>
<Button is-disabled>禁用</Button>
<Button :is-pending="pending">{{ pending ? "加载中" : "正常操作" }}</Button>
<label>
<input v-model="pending" type="checkbox" />
加载状态
</label>
</div>
</template>
<style scoped>
.handbook-state-button[data-pressed="true"] {
outline: 2px solid var(--focus);
}
</style>