「方案对比表」包含在 Pro 里,开通会员后显示预览。
用法
import { LandingPricingCompare } from './LandingPricingCompare.jsx'
// Without onChoose a plan starts after a short wait. Wire it to your checkout:
<LandingPricingCompare
locale="en"
currency="USD"
plans={plans} // [{ id, name, tagline, monthly, yearly }]
groups={featureGroups} // [{ id, name, icon, rows: [{ name, hint?, values: [true | false | string per plan] }] }]
highlight="plus"
loading={!plans}
onChoose={async (planId, billing) => (await startTrial(planId, billing)).ok}
/>属性
| 属性 | 类型 | 默认值 | 作用 |
|---|---|---|---|
locale | 'en' | 'zh-CN' | 'es' | 'ja' | 'en' | 内置文字、示例方案和价格的语言。 |
plans | Array<{ id, name, tagline, monthly, yearly }> | sample plans | 按顺序作为列显示的方案。价格按月计,yearly 是按年付时折合的月价。 |
groups | Array<{ id, name, icon?, rows: Array<{ name, hint?, values }> }> | sample features | 按类别分组的功能行。每个值是 true、false 或一小段文字;hint 会显示为这一行的说明气泡。 |
highlight | string | 'plus' | 用强调色突出的方案 id,手机上也默认先显示它。 |
currency | string | by locale | 所有价格使用的 ISO 货币代码。 |
billing | 'monthly' | 'yearly' | 'yearly' | 默认显示的付费周期。 |
loading | boolean | false | 价格加载时显示骨架。 |
onChoose / onBillingChange | (planId, billing) => Promise<boolean | void> / (billing) => void | — | 开通方案(返回 false 则保留按钮);切换付费周期时调用。 |
labels | object | — | 替换任意内置文字(键名见 copy.js)。 |
className | string | — | 加在根元素 section 上。 |
装进你的项目
Pro 包含这个区块的完整源码。复制指令,让你的 Agent 把它安装到项目中。
LandingPricingCompare.jsxlanding-pricing-compare.csscopy.jskit.jsxkit.cssui/base-button/ui/rolling-number/ui/success-check/ui/skeleton-shimmer/ui/sliding-tabs/ui/tooltip/tokens.cssREADME.md
区块本身、样式和文案、共用的 kit、用到的组件和 tokens.css 会一起装进同一个文件夹。
