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

29 lines
858 B
Vue

<script setup lang="ts">
import { ref } from "vue";
import { Button, Link, buttonVariants } from "@heroui-vue/components";
import { tv } from "@heroui-vue/styles";
const count = ref(0);
const customButton = tv({
extend: buttonVariants,
variants: { emphasis: { strong: "font-bold" } },
});
</script>
<template>
<div class="flex flex-wrap items-center gap-3">
<a href="#自定义变体" :class="buttonVariants({ variant: 'secondary' })">
链接采用按钮外观
</a>
<Button
as-child
v-slot="{ isPressed }"
:class="customButton({ emphasis: 'strong' })"
@click="count++"
>
<button type="button" :data-custom-state="isPressed ? 'pressed' : 'idle'">
自定义根节点 · {{ count }}
</button>
</Button>
<Link href="/components/button">查看 Button API</Link>
</div>
</template>