PricingTable 价格表

用于展示不同订阅方案/套餐的对比价格表,桌面端为表格布局、移动端自动切换为卡片列表,支持高亮推荐方案与自定义插槽。

何时使用

  • 需要展示定价方案对比时。
Free
$0
/月
基础功能
项目数3
团队成员1
API 访问
高级功能
自定义域名
专属支持
Pro推荐
$19
/月
基础功能
项目数无限
团队成员10
API 访问
高级功能
自定义域名
专属支持
Enterprise
$99
/月
基础功能
项目数无限
团队成员无限
API 访问
高级功能
自定义域名
专属支持

基础用法

<script setup lang="ts">
import { ref } from "vue";
import { PricingTable, type PricingTableTier, type PricingTableSection } from "@reglow/reui";

const tiers = ref<PricingTableTier[]>([
  {
    id: "free",
    title: "Free",
    price: "$0",
    billingCycle: "/月",
    button: { label: "免费开始", variant: "outline" },
  },
  {
    id: "pro",
    title: "Pro",
    price: "$19",
    billingCycle: "/月",
    badge: "推荐",
    highlight: true,
    button: { label: "升级 Pro" },
  },
]);

const sections = ref<PricingTableSection[]>([
  {
    title: "基础功能",
    features: [
      { title: "项目数", tiers: { free: "3", pro: "无限" } },
      { title: "API 访问", tiers: { free: false, pro: true } },
    ],
  },
]);
</script>

<template>
  <PricingTable :tiers="tiers" :sections="sections" />
</template>

导入

import {
  PricingTable,
  type PricingTableTier,
  type PricingTableSection,
  type PricingTableSectionFeature,
  type PricingTableProps,
} from "@reglow/reui";

Props

属性类型默认值说明
tiersPricingTableTier[]必填价格层级列表
sectionsPricingTableSection[]-功能区段列表
captionstring-表格标题(无障碍)
classstring-根节点类名

PricingTableTier

属性类型说明
idstring唯一标识(必填)
titlestring方案名称
descriptionstring简短描述
pricestring当前价格
discountstring折扣价(删除线展示)
billingCyclestring计费周期(如 /月
billingPeriodstring计费说明
badgestring标题旁徽章
button{ label?, variant?, size? }CTA 按钮配置
highlightboolean是否高亮(推荐方案)

PricingTableSection

属性类型说明
titlestring区段标题
idstring区段标识(用于插槽定位)
featuresPricingTableSectionFeature[]功能列表

PricingTableSectionFeature

属性类型说明
titlestring功能标题
tiersRecord<string, boolean | string | number>各层级对应的值:true 显示 ✓、false 显示 -、文本/数字直接展示