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

属性类型默认值必填说明
pricestring | number金额,如:'1234.56'
symbolstring显示货币货号:如:'¥'
thousandsbooleanfalse是否以千分号的形式显示,如:'1,234.56'
decimalDigitsnumber | string2保留 decimalDigits 小数位数