Price 价格
美化的价格展现组件。
import { TaPrice, TaCell, TaGroup } from '@/index'
export default function ExpPrice() {
return (
<>
<TaGroup title="基础用法">
<TaCell label="默认">
<TaPrice price="1234.56" />
</TaCell>
<TaCell label="设置符号">
<TaPrice price="1234.56" symbol="¥" />
</TaCell>
<TaCell label="千分位">
<TaPrice price="1234.56" thousands />
</TaCell>
<TaCell label="保留3位小数">
<TaPrice price="1234.56" decimalDigits={3} />
</TaCell>
</TaGroup>
<TaGroup title="设置样式">
<TaCell label="自定义颜色">
<TaPrice
className="exp-price-custom-color"
price="1234.56"
symbol="¥"
thousands
/>
</TaCell>
<TaCell label="自定义大小">
<TaPrice
className="exp-price-custom-size"
price="1234.56"
symbol="¥"
thousands
/>
</TaCell>
</TaGroup>
</>
)
}
Import
import { TaPrice } from 'tantalum-ui-mobile-react'
具体的引入方式可以参考引入组件。
Props
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
price | string | number | 是 | 金额,如:'1234.56' | |
symbol | string | 否 | 显示货币货号:如:'¥' | |
thousands | boolean | false | 否 | 是否以千分号的形式显示,如:'1,234.56' |
decimalDigits | number | string | 2 | 否 | 保留 decimalDigits 小数位数 |