Files
heroui-vue/apps/docs/demos/accordion-basic.vue
T
maoyingjie 896bac2cd7 fix(docs): restore button, toggle and nav demos to the pinned cn baseline
- button-group: restore all 9 cn demos incl. merge dropdown menu copy,
  custom-styles merge dropdown, sizes variant=secondary, orientation icon
  groups, full-width second group and the disabled child override
- toggle-button / toggle-button-group: restore cn copy, structure, button
  counts, theme custom-styles classes and aria-labels
- accordion-custom-styles: restore the 3-item collectibles scenario with the
  original 3dicons images, surface variant, selectors and hover motion
- disclosure-group-controlled: restore HeroUI Native / Expo copy and image
  semantics (Expo brand icon adapted to Tabler IconBrandReactNative)
- button-basic / button-loading-state: converge to baseline (console report,
  no added status paragraph) keeping the duplicate-trigger guard
- restore per-demo root gap/alignment/wrap classes instead of demo-row
- icon semantics per task card: search glyph kept on 搜索 buttons,
  rotate-back glyph restored (IconRefresh), person-search glyph restored
  (IconUserSearch); accordion item icons sized to the baseline 16px
2026-10-28 09:42:17 +08:00

96 lines
2.4 KiB
Vue

<script setup lang="ts">
import {
Accordion,
AccordionBody,
AccordionHeading,
AccordionIndicator,
AccordionItem,
AccordionPanel,
AccordionTrigger,
} from "@heroui-vue/components";
import {
IconRefresh,
IconBox,
IconChevronDown,
IconCreditCard,
IconReceipt,
IconShoppingBag,
IconWorld,
} from "@tabler/icons-vue";
const iconMap = {
box: IconBox,
card: IconCreditCard,
cart: IconShoppingBag,
earth: IconWorld,
receipt: IconReceipt,
rotate: IconRefresh,
} 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)"
class="size-4"
aria-hidden="true"
/>
</span>
{{ item.title }}
<AccordionIndicator>
<IconChevronDown />
</AccordionIndicator>
</AccordionTrigger>
</AccordionHeading>
<AccordionPanel>
<AccordionBody>{{ item.content }}</AccordionBody>
</AccordionPanel>
</AccordionItem>
</Accordion>
</template>