Files
heroui-vue/apps/docs/demos/disclosure-group-basic.vue
T
2026-10-22 18:25:08 +08:00

110 lines
3.9 KiB
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 {
Button,
Disclosure,
DisclosureBody,
DisclosureContent,
DisclosureGroup,
DisclosureHeading,
DisclosureIndicator,
DisclosureTrigger,
Separator,
} from "@heroui-vue/components";
import {
IconQrcode,
IconBrandAppleFilled,
IconDeviceMobile,
} from "@tabler/icons-vue";
const expandedKeys = ref<Array<string | number>>(["preview"]);
</script>
<template>
<div class="w-full max-w-md">
<div class="flex flex-col gap-4 bg-transparent p-4">
<DisclosureGroup v-model:expanded-keys="expandedKeys">
<Disclosure id="preview" aria-label="预览 HeroUI Native">
<DisclosureHeading>
<DisclosureTrigger as-child>
<Button
class="w-full border-none"
:variant="
expandedKeys.includes('preview') ? 'secondary' : 'tertiary'
"
:class="{ 'bg-transparent': !expandedKeys.includes('preview') }"
>
<div class="flex w-full items-center justify-start gap-2">
<IconQrcode aria-hidden="true" />
预览 HeroUI Native
</div>
<DisclosureIndicator class="text-muted" />
</Button>
</DisclosureTrigger>
</DisclosureHeading>
<DisclosureContent>
<DisclosureBody
class="mx-2 flex flex-col items-center gap-2 p-4 text-center"
>
<p class="text-sm text-muted">
使用手机相机扫描此二维码,即可预览 HeroUI Native 组件。
</p>
<img
alt="Expo Go 二维码"
class="aspect-square w-full max-w-54 object-cover"
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/images/qr-code-native.png"
/>
<p class="text-sm text-muted">设备需已安装 Expo。</p>
<Button class="mt-4" variant="primary">
<IconDeviceMobile aria-hidden="true" />
在 Expo Go 预览
</Button>
</DisclosureBody>
</DisclosureContent>
</Disclosure>
<Separator class="my-2" />
<Disclosure id="download">
<DisclosureHeading aria-label="下载 HeroUI Native">
<DisclosureTrigger as-child>
<Button
class="w-full border-none"
:variant="
expandedKeys.includes('download') ? 'secondary' : 'tertiary'
"
:class="{
'bg-transparent': !expandedKeys.includes('download'),
}"
>
<div class="flex w-full items-center justify-start gap-2">
<IconBrandAppleFilled aria-hidden="true" />
下载应用
</div>
<DisclosureIndicator class="text-muted" />
</Button>
</DisclosureTrigger>
</DisclosureHeading>
<DisclosureContent>
<DisclosureBody
class="mx-2 flex flex-col items-center gap-2 p-4 text-center"
>
<p class="text-sm text-muted">
下载 HeroUI Native 应用,即可在设备上直接体验我们的移动端组件。
</p>
<img
alt="App Store 二维码"
class="aspect-square w-full max-w-54 object-cover"
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/images/qr-code-native.png"
/>
<p class="text-sm text-muted">支持 iOS 和 Android 设备。</p>
<Button class="mt-4" variant="primary">
<IconBrandAppleFilled aria-hidden="true" />
在 App Store 下载
</Button>
</DisclosureBody>
</DisclosureContent>
</Disclosure>
</DisclosureGroup>
</div>
</div>
</template>