feat: add Disclosure DisclosureGroup and Accordion
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Accordion,
|
||||
AccordionBody,
|
||||
AccordionHeading,
|
||||
AccordionIndicator,
|
||||
AccordionItem,
|
||||
AccordionPanel,
|
||||
AccordionTrigger,
|
||||
} from "@heroui-vue/components";
|
||||
import {
|
||||
IconArrowsLeftRight,
|
||||
IconBox,
|
||||
IconChevronDown,
|
||||
IconCreditCard,
|
||||
IconReceipt,
|
||||
IconShoppingBag,
|
||||
IconWorld,
|
||||
} from "@tabler/icons-vue";
|
||||
|
||||
const iconMap = {
|
||||
box: IconBox,
|
||||
card: IconCreditCard,
|
||||
cart: IconShoppingBag,
|
||||
earth: IconWorld,
|
||||
receipt: IconReceipt,
|
||||
rotate: IconArrowsLeftRight,
|
||||
} as const;
|
||||
|
||||
function iconFor(key: keyof typeof iconMap) {
|
||||
return iconMap[key];
|
||||
}
|
||||
|
||||
const items = [
|
||||
{
|
||||
content:
|
||||
"浏览我们的商品,将商品加入购物车并前往结账。完成购买需要提供收货与支付信息。",
|
||||
icon: "cart",
|
||||
title: "如何下单?",
|
||||
},
|
||||
{
|
||||
content:
|
||||
"可以,在订单发货前你可以修改或取消。订单一旦进入处理流程,将无法再更改。",
|
||||
icon: "receipt",
|
||||
title: "可以修改或取消订单吗?",
|
||||
},
|
||||
{
|
||||
content: "我们接受主流信用卡,包括 Visa、Mastercard 和 American Express。",
|
||||
icon: "card",
|
||||
title: "支持哪些支付方式?",
|
||||
},
|
||||
{
|
||||
content: "运费因收货地址与订单体积而异。订单满 50 美元可享受免运费。",
|
||||
icon: "box",
|
||||
title: "运费如何计算?",
|
||||
},
|
||||
{
|
||||
content:
|
||||
"是的,我们可向多数国家/地区发货。请查看运费说明与政策了解更多信息。",
|
||||
icon: "earth",
|
||||
title: "是否提供国际配送?",
|
||||
},
|
||||
{
|
||||
content:
|
||||
"若对购买不满意,可在购买后 30 天内申请退款。请联系客服团队协助处理。",
|
||||
icon: "rotate",
|
||||
title: "如何申请退款?",
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Accordion class="w-full max-w-md">
|
||||
<AccordionItem v-for="(item, index) in items" :key="index">
|
||||
<AccordionHeading>
|
||||
<AccordionTrigger>
|
||||
<span class="me-3 size-4 shrink-0 text-muted">
|
||||
<component
|
||||
:is="iconFor(item.icon as keyof typeof iconMap)"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</span>
|
||||
{{ item.title }}
|
||||
<AccordionIndicator>
|
||||
<IconChevronDown />
|
||||
</AccordionIndicator>
|
||||
</AccordionTrigger>
|
||||
</AccordionHeading>
|
||||
<AccordionPanel>
|
||||
<AccordionBody>{{ item.content }}</AccordionBody>
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
</template>
|
||||
@@ -0,0 +1,94 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from "vue";
|
||||
import {
|
||||
Accordion,
|
||||
AccordionBody,
|
||||
AccordionHeading,
|
||||
AccordionIndicator,
|
||||
AccordionItem,
|
||||
AccordionPanel,
|
||||
AccordionTrigger,
|
||||
Button,
|
||||
useDisclosureGroupNavigation,
|
||||
} from "@heroui-vue/components";
|
||||
import { IconChevronUp, IconChevronDown } from "@tabler/icons-vue";
|
||||
|
||||
const items = [
|
||||
{
|
||||
content:
|
||||
"了解 HeroUI 的基础知识,以及如何将其集成到你的 React 项目中。本节涵盖安装、配置和你的第一个组件。",
|
||||
id: "getting-started",
|
||||
title: "快速开始",
|
||||
},
|
||||
{
|
||||
content:
|
||||
"理解 HeroUI 背后的核心概念,包括复合组件模式、使用 Tailwind CSS 进行样式设计,以及无障碍特性。",
|
||||
id: "core-concepts",
|
||||
title: "核心概念",
|
||||
},
|
||||
{
|
||||
content:
|
||||
"探索高级特性,例如自定义变体、主题定制,以及与 React 生态中其他库的集成。",
|
||||
id: "advanced-usage",
|
||||
title: "高级用法",
|
||||
},
|
||||
];
|
||||
|
||||
const expandedKeys = ref<Array<string | number>>(["getting-started"]);
|
||||
const itemIds = items.map((item) => item.id);
|
||||
|
||||
const { isNextDisabled, isPrevDisabled, onNext, onPrevious } =
|
||||
useDisclosureGroupNavigation({
|
||||
expandedKeys,
|
||||
itemIds,
|
||||
onExpandedChange: (keys) => {
|
||||
expandedKeys.value = keys;
|
||||
},
|
||||
});
|
||||
|
||||
const expandedText = computed(() => expandedKeys.value.join("、") || "无");
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="w-full max-w-md">
|
||||
<div class="mb-4 flex items-center justify-between">
|
||||
<p class="text-sm text-muted">
|
||||
已展开:
|
||||
<strong>{{ expandedText }}</strong>
|
||||
</p>
|
||||
<div class="flex gap-2">
|
||||
<Button
|
||||
aria-label="上一项"
|
||||
:is-disabled="isPrevDisabled"
|
||||
size="sm"
|
||||
variant="secondary"
|
||||
@click="onPrevious"
|
||||
>
|
||||
<IconChevronUp class="size-4" aria-hidden="true" />
|
||||
</Button>
|
||||
<Button
|
||||
aria-label="下一项"
|
||||
:is-disabled="isNextDisabled"
|
||||
size="sm"
|
||||
variant="secondary"
|
||||
@click="onNext"
|
||||
>
|
||||
<IconChevronDown class="size-4" aria-hidden="true" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<Accordion v-model:expanded-keys="expandedKeys">
|
||||
<AccordionItem v-for="item in items" :key="item.id" :id="item.id">
|
||||
<AccordionHeading>
|
||||
<AccordionTrigger>
|
||||
{{ item.title }}
|
||||
<AccordionIndicator />
|
||||
</AccordionTrigger>
|
||||
</AccordionHeading>
|
||||
<AccordionPanel>
|
||||
<AccordionBody>{{ item.content }}</AccordionBody>
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,77 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import {
|
||||
Accordion,
|
||||
AccordionBody,
|
||||
AccordionHeading,
|
||||
AccordionIndicator,
|
||||
AccordionItem,
|
||||
AccordionPanel,
|
||||
AccordionTrigger,
|
||||
} from "@heroui-vue/components";
|
||||
import {
|
||||
IconChevronsDown,
|
||||
IconCircleChevronDown,
|
||||
IconMinus,
|
||||
IconPlus,
|
||||
} from "@tabler/icons-vue";
|
||||
|
||||
const expandedKeys = ref<Array<string | number>>([]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Accordion
|
||||
v-model:expanded-keys="expandedKeys"
|
||||
class="w-full max-w-md"
|
||||
variant="surface"
|
||||
>
|
||||
<AccordionItem id="1">
|
||||
<AccordionHeading>
|
||||
<AccordionTrigger>
|
||||
使用加号/减号图标
|
||||
<AccordionIndicator>
|
||||
<IconMinus v-if="expandedKeys.includes('1')" />
|
||||
<IconPlus v-else />
|
||||
</AccordionIndicator>
|
||||
</AccordionTrigger>
|
||||
</AccordionHeading>
|
||||
<AccordionPanel>
|
||||
<AccordionBody>
|
||||
折叠时显示加号图标,展开时切换为减号图标。
|
||||
</AccordionBody>
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem id="2">
|
||||
<AccordionHeading>
|
||||
<AccordionTrigger>
|
||||
使用圆形箭头图标
|
||||
<AccordionIndicator>
|
||||
<IconCircleChevronDown />
|
||||
</AccordionIndicator>
|
||||
</AccordionTrigger>
|
||||
</AccordionHeading>
|
||||
<AccordionPanel>
|
||||
<AccordionBody>
|
||||
此项使用圆形内的箭头作为指示器,旋转动画会自动应用。
|
||||
</AccordionBody>
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem id="3">
|
||||
<AccordionHeading>
|
||||
<AccordionTrigger>
|
||||
使用双箭头图标
|
||||
<AccordionIndicator>
|
||||
<IconChevronsDown />
|
||||
</AccordionIndicator>
|
||||
</AccordionTrigger>
|
||||
</AccordionHeading>
|
||||
<AccordionPanel>
|
||||
<AccordionBody>
|
||||
此项使用双箭头图标。传入任意图标后,在条目展开时都会获得旋转动画。
|
||||
</AccordionBody>
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
</template>
|
||||
@@ -0,0 +1,42 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Accordion,
|
||||
AccordionBody,
|
||||
AccordionHeading,
|
||||
AccordionIndicator,
|
||||
AccordionItem,
|
||||
AccordionPanel,
|
||||
AccordionTrigger,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Accordion class="w-full max-w-md rounded-xl bg-gray-50 dark:bg-neutral-900">
|
||||
<AccordionItem>
|
||||
<AccordionHeading>
|
||||
<AccordionTrigger class="text-lg font-semibold">
|
||||
自定义标题字号
|
||||
<AccordionIndicator />
|
||||
</AccordionTrigger>
|
||||
</AccordionHeading>
|
||||
<AccordionPanel>
|
||||
<AccordionBody class="text-base text-foreground">
|
||||
通过覆盖 trigger 与 body 的 class,可以快速调整字号与颜色。
|
||||
</AccordionBody>
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
<AccordionItem>
|
||||
<AccordionHeading>
|
||||
<AccordionTrigger class="text-lg font-semibold">
|
||||
描边容器
|
||||
<AccordionIndicator />
|
||||
</AccordionTrigger>
|
||||
</AccordionHeading>
|
||||
<AccordionPanel>
|
||||
<AccordionBody class="rounded-lg border-2 border-border p-4 shadow-lg">
|
||||
给根容器加边框与阴影,得到描边变体的观感。
|
||||
</AccordionBody>
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
</template>
|
||||
@@ -0,0 +1,85 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Accordion,
|
||||
AccordionBody,
|
||||
AccordionHeading,
|
||||
AccordionIndicator,
|
||||
AccordionItem,
|
||||
AccordionPanel,
|
||||
AccordionTrigger,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex w-full flex-col items-center gap-8">
|
||||
<div class="w-full max-w-md space-y-2">
|
||||
<h3 class="text-sm font-medium text-muted">整个手风琴禁用</h3>
|
||||
<Accordion is-disabled class="w-full max-w-md">
|
||||
<AccordionItem>
|
||||
<AccordionHeading>
|
||||
<AccordionTrigger>
|
||||
禁用项 1
|
||||
<AccordionIndicator />
|
||||
</AccordionTrigger>
|
||||
</AccordionHeading>
|
||||
<AccordionPanel>
|
||||
<AccordionBody>手风琴禁用时无法查看此内容。</AccordionBody>
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem>
|
||||
<AccordionHeading>
|
||||
<AccordionTrigger>
|
||||
禁用项 2
|
||||
<AccordionIndicator />
|
||||
</AccordionTrigger>
|
||||
</AccordionHeading>
|
||||
<AccordionPanel>
|
||||
<AccordionBody>手风琴禁用时无法查看此内容。</AccordionBody>
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
</div>
|
||||
|
||||
<div class="w-full max-w-md space-y-2">
|
||||
<h3 class="text-sm font-medium text-muted">单独禁用条目</h3>
|
||||
<Accordion class="w-full max-w-md">
|
||||
<AccordionItem>
|
||||
<AccordionHeading>
|
||||
<AccordionTrigger>
|
||||
可用项
|
||||
<AccordionIndicator />
|
||||
</AccordionTrigger>
|
||||
</AccordionHeading>
|
||||
<AccordionPanel>
|
||||
<AccordionBody>此项可用,可正常展开与折叠。</AccordionBody>
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem is-disabled>
|
||||
<AccordionHeading>
|
||||
<AccordionTrigger>
|
||||
禁用项
|
||||
<AccordionIndicator />
|
||||
</AccordionTrigger>
|
||||
</AccordionHeading>
|
||||
<AccordionPanel>
|
||||
<AccordionBody>条目禁用时无法查看此内容。</AccordionBody>
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem>
|
||||
<AccordionHeading>
|
||||
<AccordionTrigger>
|
||||
另一可用项
|
||||
<AccordionIndicator />
|
||||
</AccordionTrigger>
|
||||
</AccordionHeading>
|
||||
<AccordionPanel>
|
||||
<AccordionBody>此项同样可用,可正常切换。</AccordionBody>
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,83 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Accordion,
|
||||
AccordionBody,
|
||||
AccordionHeading,
|
||||
AccordionIndicator,
|
||||
AccordionItem,
|
||||
AccordionPanel,
|
||||
AccordionTrigger,
|
||||
} from "@heroui-vue/components";
|
||||
import { IconChevronDown } from "@tabler/icons-vue";
|
||||
|
||||
const categories = [
|
||||
{
|
||||
items: [
|
||||
{
|
||||
content:
|
||||
"浏览我们的商品,将商品加入购物车并前往结账。完成购买需要提供收货与支付信息。",
|
||||
title: "如何下单?",
|
||||
},
|
||||
{
|
||||
content:
|
||||
"可以,在订单发货前你可以修改或取消。订单一旦进入处理流程,将无法再更改。",
|
||||
title: "可以修改或取消订单吗?",
|
||||
},
|
||||
],
|
||||
title: "常规",
|
||||
},
|
||||
{
|
||||
items: [
|
||||
{
|
||||
content:
|
||||
"你可以直接在官网购买许可证,选择适合的许可证类型后前往结账即可。",
|
||||
title: "如何购买许可证?",
|
||||
},
|
||||
{
|
||||
content: "标准版适用于个人或小项目;专业版包含商业使用授权与优先支持。",
|
||||
title: "标准版与专业版有什么区别?",
|
||||
},
|
||||
],
|
||||
title: "许可",
|
||||
},
|
||||
{
|
||||
items: [
|
||||
{
|
||||
content:
|
||||
"可通过网站上的联系表单联系支持团队,或直接发送邮件至 support@example.com。",
|
||||
title: "如何获取支持?",
|
||||
},
|
||||
],
|
||||
title: "支持",
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex w-full flex-col gap-6">
|
||||
<div class="flex flex-col gap-1">
|
||||
<h2 class="text-2xl font-bold">常见问题</h2>
|
||||
<p class="mb-4 text-lg font-medium text-muted">
|
||||
关于许可与使用,你需要了解的内容都在这里。
|
||||
</p>
|
||||
</div>
|
||||
<div v-for="category in categories" :key="category.title">
|
||||
<p class="text-md mb-2 font-medium text-muted">{{ category.title }}</p>
|
||||
<Accordion class="w-full" variant="surface">
|
||||
<AccordionItem v-for="(item, index) in category.items" :key="index">
|
||||
<AccordionHeading>
|
||||
<AccordionTrigger>
|
||||
{{ item.title }}
|
||||
<AccordionIndicator>
|
||||
<IconChevronDown />
|
||||
</AccordionIndicator>
|
||||
</AccordionTrigger>
|
||||
</AccordionHeading>
|
||||
<AccordionPanel>
|
||||
<AccordionBody>{{ item.content }}</AccordionBody>
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,50 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Accordion,
|
||||
AccordionBody,
|
||||
AccordionHeading,
|
||||
AccordionIndicator,
|
||||
AccordionItem,
|
||||
AccordionPanel,
|
||||
AccordionTrigger,
|
||||
} from "@heroui-vue/components";
|
||||
|
||||
const items = [
|
||||
{
|
||||
content:
|
||||
"了解 HeroUI 的基础知识,以及如何将其集成到你的 React 项目中。本节涵盖安装、配置和你的第一个组件。",
|
||||
title: "快速开始",
|
||||
},
|
||||
{
|
||||
content:
|
||||
"理解 HeroUI 背后的核心概念,包括复合组件模式、使用 Tailwind CSS 进行样式设计,以及无障碍特性。",
|
||||
title: "核心概念",
|
||||
},
|
||||
{
|
||||
content:
|
||||
"探索高级特性,例如自定义变体、主题定制,以及与 React 生态中其他库的集成。",
|
||||
title: "高级用法",
|
||||
},
|
||||
{
|
||||
content:
|
||||
"遵循我们建议的最佳实践,使用 HeroUI 构建高性能、无障碍且易于维护的应用。",
|
||||
title: "最佳实践",
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Accordion allows-multiple-expanded class="w-full max-w-md">
|
||||
<AccordionItem v-for="(item, index) in items" :key="index">
|
||||
<AccordionHeading>
|
||||
<AccordionTrigger>
|
||||
{{ item.title }}
|
||||
<AccordionIndicator />
|
||||
</AccordionTrigger>
|
||||
</AccordionHeading>
|
||||
<AccordionPanel>
|
||||
<AccordionBody>{{ item.content }}</AccordionBody>
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
</template>
|
||||
@@ -0,0 +1,83 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Accordion,
|
||||
AccordionBody,
|
||||
AccordionHeading,
|
||||
AccordionIndicator,
|
||||
AccordionItem,
|
||||
AccordionPanel,
|
||||
AccordionTrigger,
|
||||
} from "@heroui-vue/components";
|
||||
import {
|
||||
IconArrowsLeftRight,
|
||||
IconBox,
|
||||
IconChevronDown,
|
||||
IconCreditCard,
|
||||
IconReceipt,
|
||||
IconShoppingBag,
|
||||
IconWorld,
|
||||
} from "@tabler/icons-vue";
|
||||
|
||||
const items = [
|
||||
{
|
||||
content:
|
||||
"浏览我们的商品,将商品加入购物车并前往结账。完成购买需要提供收货与支付信息。",
|
||||
icon: IconShoppingBag,
|
||||
title: "如何下单?",
|
||||
},
|
||||
{
|
||||
content:
|
||||
"可以,在订单发货前你可以修改或取消。订单一旦进入处理流程,将无法再更改。",
|
||||
icon: IconReceipt,
|
||||
title: "可以修改或取消订单吗?",
|
||||
},
|
||||
{
|
||||
content: "我们接受主流信用卡,包括 Visa、Mastercard 和 American Express。",
|
||||
icon: IconCreditCard,
|
||||
title: "支持哪些支付方式?",
|
||||
},
|
||||
{
|
||||
content: "运费因收货地址与订单体积而异。订单满 50 美元可享受免运费。",
|
||||
icon: IconBox,
|
||||
title: "运费如何计算?",
|
||||
},
|
||||
{
|
||||
content:
|
||||
"是的,我们可向多数国家/地区发货。请查看运费说明与政策了解更多信息。",
|
||||
icon: IconWorld,
|
||||
title: "是否提供国际配送?",
|
||||
},
|
||||
{
|
||||
content:
|
||||
"若对购买不满意,可在购买后 30 天内申请退款。请联系客服团队协助处理。",
|
||||
icon: IconArrowsLeftRight,
|
||||
title: "如何申请退款?",
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Accordion class="w-full max-w-md" as="div" data-custom="accordion">
|
||||
<AccordionItem
|
||||
v-for="(item, index) in items"
|
||||
:key="index"
|
||||
as="div"
|
||||
data-custom="item"
|
||||
>
|
||||
<AccordionHeading as="div" data-custom="heading">
|
||||
<AccordionTrigger as="button" data-custom="trigger">
|
||||
<span class="me-3 size-4 shrink-0 text-muted">
|
||||
<component :is="item.icon" aria-hidden="true" />
|
||||
</span>
|
||||
{{ item.title }}
|
||||
<AccordionIndicator>
|
||||
<IconChevronDown />
|
||||
</AccordionIndicator>
|
||||
</AccordionTrigger>
|
||||
</AccordionHeading>
|
||||
<AccordionPanel as="div" data-custom="panel">
|
||||
<AccordionBody>{{ item.content }}</AccordionBody>
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
</template>
|
||||
@@ -0,0 +1,94 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Accordion,
|
||||
AccordionBody,
|
||||
AccordionHeading,
|
||||
AccordionIndicator,
|
||||
AccordionItem,
|
||||
AccordionPanel,
|
||||
AccordionTrigger,
|
||||
} from "@heroui-vue/components";
|
||||
import {
|
||||
IconArrowsLeftRight,
|
||||
IconBox,
|
||||
IconChevronDown,
|
||||
IconCreditCard,
|
||||
IconReceipt,
|
||||
IconShoppingBag,
|
||||
IconWorld,
|
||||
} from "@tabler/icons-vue";
|
||||
|
||||
const iconMap = {
|
||||
box: IconBox,
|
||||
card: IconCreditCard,
|
||||
cart: IconShoppingBag,
|
||||
earth: IconWorld,
|
||||
receipt: IconReceipt,
|
||||
rotate: IconArrowsLeftRight,
|
||||
} as const;
|
||||
|
||||
function iconFor(key: keyof typeof iconMap) {
|
||||
return iconMap[key];
|
||||
}
|
||||
|
||||
const items = [
|
||||
{
|
||||
content:
|
||||
"浏览我们的商品,将商品加入购物车并前往结账。完成购买需要提供收货与支付信息。",
|
||||
icon: "cart",
|
||||
title: "如何下单?",
|
||||
},
|
||||
{
|
||||
content:
|
||||
"可以,在订单发货前你可以修改或取消。订单一旦进入处理流程,将无法再更改。",
|
||||
icon: "receipt",
|
||||
title: "可以修改或取消订单吗?",
|
||||
},
|
||||
{
|
||||
content: "我们接受主流信用卡,包括 Visa、Mastercard 和 American Express。",
|
||||
icon: "card",
|
||||
title: "支持哪些支付方式?",
|
||||
},
|
||||
{
|
||||
content: "运费因收货地址与订单体积而异。订单满 50 美元可享受免运费。",
|
||||
icon: "box",
|
||||
title: "运费如何计算?",
|
||||
},
|
||||
{
|
||||
content:
|
||||
"是的,我们可向多数国家/地区发货。请查看运费说明与政策了解更多信息。",
|
||||
icon: "earth",
|
||||
title: "是否提供国际配送?",
|
||||
},
|
||||
{
|
||||
content:
|
||||
"若对购买不满意,可在购买后 30 天内申请退款。请联系客服团队协助处理。",
|
||||
icon: "rotate",
|
||||
title: "如何申请退款?",
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Accordion class="w-full max-w-md" variant="surface">
|
||||
<AccordionItem v-for="(item, index) in items" :key="index">
|
||||
<AccordionHeading>
|
||||
<AccordionTrigger>
|
||||
<span class="me-3 size-4 shrink-0 text-muted">
|
||||
<component
|
||||
:is="iconFor(item.icon as keyof typeof iconMap)"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</span>
|
||||
{{ item.title }}
|
||||
<AccordionIndicator>
|
||||
<IconChevronDown />
|
||||
</AccordionIndicator>
|
||||
</AccordionTrigger>
|
||||
</AccordionHeading>
|
||||
<AccordionPanel>
|
||||
<AccordionBody>{{ item.content }}</AccordionBody>
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
</template>
|
||||
@@ -0,0 +1,58 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Accordion,
|
||||
AccordionBody,
|
||||
AccordionHeading,
|
||||
AccordionIndicator,
|
||||
AccordionItem,
|
||||
AccordionPanel,
|
||||
AccordionTrigger,
|
||||
} from "@heroui-vue/components";
|
||||
import {
|
||||
IconBox,
|
||||
IconChevronDown,
|
||||
IconCreditCard,
|
||||
IconShoppingBag,
|
||||
} from "@tabler/icons-vue";
|
||||
|
||||
const items = [
|
||||
{
|
||||
content:
|
||||
"浏览我们的商品,将商品加入购物车并前往结账。完成购买需要提供收货与支付信息。",
|
||||
icon: IconShoppingBag,
|
||||
title: "如何下单?",
|
||||
},
|
||||
{
|
||||
content:
|
||||
"可以,在订单发货前你可以修改或取消。订单一旦进入处理流程,将无法再更改。",
|
||||
icon: IconCreditCard,
|
||||
title: "可以修改或取消订单吗?",
|
||||
},
|
||||
{
|
||||
content: "我们接受主流信用卡,包括 Visa、Mastercard 和 American Express。",
|
||||
icon: IconBox,
|
||||
title: "支持哪些支付方式?",
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Accordion hide-separator class="w-full max-w-md">
|
||||
<AccordionItem v-for="(item, index) in items" :key="index">
|
||||
<AccordionHeading>
|
||||
<AccordionTrigger>
|
||||
<span class="me-3 size-4 shrink-0 text-muted">
|
||||
<component :is="item.icon" aria-hidden="true" />
|
||||
</span>
|
||||
{{ item.title }}
|
||||
<AccordionIndicator>
|
||||
<IconChevronDown />
|
||||
</AccordionIndicator>
|
||||
</AccordionTrigger>
|
||||
</AccordionHeading>
|
||||
<AccordionPanel>
|
||||
<AccordionBody>{{ item.content }}</AccordionBody>
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
</template>
|
||||
@@ -0,0 +1,50 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import {
|
||||
Button,
|
||||
Disclosure,
|
||||
DisclosureBody,
|
||||
DisclosureContent,
|
||||
DisclosureHeading,
|
||||
DisclosureIndicator,
|
||||
DisclosureTrigger,
|
||||
} from "@heroui-vue/components";
|
||||
import { IconQrcode, IconBrandAppleFilled } from "@tabler/icons-vue";
|
||||
|
||||
const isExpanded = ref(true);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="w-full max-w-md text-center">
|
||||
<Disclosure v-model:expanded="isExpanded">
|
||||
<DisclosureHeading>
|
||||
<DisclosureTrigger as-child>
|
||||
<Button variant="secondary">
|
||||
<IconQrcode aria-hidden="true" />
|
||||
预览 HeroUI Native
|
||||
<DisclosureIndicator />
|
||||
</Button>
|
||||
</DisclosureTrigger>
|
||||
</DisclosureHeading>
|
||||
<DisclosureContent>
|
||||
<DisclosureBody
|
||||
class="shadow-panel flex flex-col items-center rounded-3xl bg-surface 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">
|
||||
<IconBrandAppleFilled aria-hidden="true" />
|
||||
在 App Store 下载
|
||||
</Button>
|
||||
</DisclosureBody>
|
||||
</DisclosureContent>
|
||||
</Disclosure>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,43 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import {
|
||||
Button,
|
||||
Disclosure,
|
||||
DisclosureBody,
|
||||
DisclosureContent,
|
||||
DisclosureHeading,
|
||||
DisclosureIndicator,
|
||||
DisclosureTrigger,
|
||||
} from "@heroui-vue/components";
|
||||
import { IconShoppingBag } from "@tabler/icons-vue";
|
||||
|
||||
const isExpanded = ref(false);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="w-full max-w-sm">
|
||||
<Disclosure v-model:expanded="isExpanded">
|
||||
<DisclosureHeading>
|
||||
<DisclosureTrigger as-child>
|
||||
<Button
|
||||
class="w-full justify-between rounded-xl border border-border/70 bg-linear-to-b from-neutral-50/90 to-white px-4 py-3 font-medium text-foreground shadow-sm ring-1 ring-black/5 hover:bg-muted/30 dark:from-neutral-900/80 dark:to-neutral-900 dark:ring-white/10"
|
||||
variant="ghost"
|
||||
>
|
||||
<span class="flex items-center gap-2">
|
||||
<IconShoppingBag class="size-4 text-muted" aria-hidden="true" />
|
||||
配送详情
|
||||
</span>
|
||||
<DisclosureIndicator class="text-muted" />
|
||||
</Button>
|
||||
</DisclosureTrigger>
|
||||
</DisclosureHeading>
|
||||
<DisclosureContent>
|
||||
<DisclosureBody
|
||||
class="mt-2 rounded-xl border border-border/70 bg-surface/50 p-4 text-sm leading-relaxed text-muted dark:bg-neutral-900/50"
|
||||
>
|
||||
订单将在 2 个工作日内发货。标准配送需 3–5 天;结账时可选择加急配送。
|
||||
</DisclosureBody>
|
||||
</DisclosureContent>
|
||||
</Disclosure>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,109 @@
|
||||
<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>
|
||||
@@ -0,0 +1,145 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import {
|
||||
Button,
|
||||
Disclosure,
|
||||
DisclosureBody,
|
||||
DisclosureContent,
|
||||
DisclosureGroup,
|
||||
DisclosureHeading,
|
||||
DisclosureIndicator,
|
||||
DisclosureTrigger,
|
||||
Separator,
|
||||
useDisclosureGroupNavigation,
|
||||
} from "@heroui-vue/components";
|
||||
import {
|
||||
IconChevronUp,
|
||||
IconChevronDown,
|
||||
IconQrcode,
|
||||
IconBrandAppleFilled,
|
||||
IconDeviceMobile,
|
||||
} from "@tabler/icons-vue";
|
||||
|
||||
const expandedKeys = ref<Array<string | number>>(["preview"]);
|
||||
const itemIds: Array<string | number> = ["preview", "download"];
|
||||
|
||||
const { isNextDisabled, isPrevDisabled, onNext, onPrevious } =
|
||||
useDisclosureGroupNavigation({
|
||||
expandedKeys,
|
||||
itemIds,
|
||||
onExpandedChange: (keys) => {
|
||||
expandedKeys.value = keys;
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="w-full max-w-md">
|
||||
<div class="flex flex-col gap-4 rounded-3xl p-4">
|
||||
<div class="mb-2 flex items-center justify-between">
|
||||
<h3 class="text-lg font-semibold">HeroUI Native</h3>
|
||||
<div class="flex gap-2">
|
||||
<Button
|
||||
aria-label="上一个折叠项"
|
||||
:is-disabled="isPrevDisabled"
|
||||
size="sm"
|
||||
variant="secondary"
|
||||
@click="onPrevious"
|
||||
>
|
||||
<IconChevronUp class="size-4" aria-hidden="true" />
|
||||
</Button>
|
||||
<Button
|
||||
aria-label="下一个折叠项"
|
||||
:is-disabled="isNextDisabled"
|
||||
size="sm"
|
||||
variant="secondary"
|
||||
@click="onNext"
|
||||
>
|
||||
<IconChevronDown class="size-4" aria-hidden="true" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
@@ -0,0 +1,49 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Button,
|
||||
Disclosure,
|
||||
DisclosureBody,
|
||||
DisclosureContent,
|
||||
DisclosureGroup,
|
||||
DisclosureHeading,
|
||||
DisclosureIndicator,
|
||||
DisclosureTrigger,
|
||||
Separator,
|
||||
} from "@heroui-vue/components";
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DisclosureGroup class="w-full max-w-sm rounded-xl bg-default-soft p-2">
|
||||
<Disclosure id="billing">
|
||||
<DisclosureHeading>
|
||||
<DisclosureTrigger as-child>
|
||||
<Button class="w-full justify-between" variant="ghost">
|
||||
账单
|
||||
<DisclosureIndicator class="text-muted" />
|
||||
</Button>
|
||||
</DisclosureTrigger>
|
||||
</DisclosureHeading>
|
||||
<DisclosureContent>
|
||||
<DisclosureBody class="text-sm text-muted">
|
||||
发票将于每月 1 日开具。
|
||||
</DisclosureBody>
|
||||
</DisclosureContent>
|
||||
</Disclosure>
|
||||
<Separator class="my-1" />
|
||||
<Disclosure id="support">
|
||||
<DisclosureHeading>
|
||||
<DisclosureTrigger as-child>
|
||||
<Button class="w-full justify-between" variant="ghost">
|
||||
支持
|
||||
<DisclosureIndicator class="text-muted" />
|
||||
</Button>
|
||||
</DisclosureTrigger>
|
||||
</DisclosureHeading>
|
||||
<DisclosureContent>
|
||||
<DisclosureBody class="text-sm text-muted">
|
||||
请通过 help@heroui.com 联系我们。通常会在一个工作日内回复。
|
||||
</DisclosureBody>
|
||||
</DisclosureContent>
|
||||
</Disclosure>
|
||||
</DisclosureGroup>
|
||||
</template>
|
||||
@@ -0,0 +1,50 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import {
|
||||
Button,
|
||||
Disclosure,
|
||||
DisclosureBody,
|
||||
DisclosureContent,
|
||||
DisclosureHeading,
|
||||
DisclosureIndicator,
|
||||
DisclosureTrigger,
|
||||
} from "@heroui-vue/components";
|
||||
import { IconQrcode, IconBrandAppleFilled } from "@tabler/icons-vue";
|
||||
|
||||
const isExpanded = ref(true);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="w-full max-w-md text-center">
|
||||
<Disclosure v-model:expanded="isExpanded" as="div" data-custom="foo">
|
||||
<DisclosureHeading>
|
||||
<DisclosureTrigger as-child>
|
||||
<Button variant="secondary">
|
||||
<IconQrcode aria-hidden="true" />
|
||||
预览 HeroUI Native
|
||||
<DisclosureIndicator />
|
||||
</Button>
|
||||
</DisclosureTrigger>
|
||||
</DisclosureHeading>
|
||||
<DisclosureContent as="div" data-custom="bar">
|
||||
<DisclosureBody
|
||||
class="shadow-panel flex flex-col items-center rounded-3xl bg-surface 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">
|
||||
<IconBrandAppleFilled aria-hidden="true" />
|
||||
在 App Store 下载
|
||||
</Button>
|
||||
</DisclosureBody>
|
||||
</DisclosureContent>
|
||||
</Disclosure>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user