Skip to content

Price Amount Component

A business component for displaying price amounts, supporting differentiated display of number sizes before and after the decimal point to enhance the visual effect and readability of amounts.

📌 Platform Differences

APP(vue)H5WeChat Mini ProgramAlipay Mini Program

Component Features

  • Differentiated Display: Automatically distinguishes number sizes before and after the decimal point, enhancing visual hierarchy
  • Flexible Configuration: Supports custom color, size, weight, slant, and other style properties
  • Multi-symbol Support: Custom currency symbols to accommodate different currency needs
  • Formatting Control: Supports setting the number of decimal places for precise control over amount display
  • Responsive Design: Adapts to multiple platforms while maintaining consistent visual effects

🏯 Basic Usage Examples

vue
<!-- Global usage -->
<hy-price :text="price"></hy-price>
ts
const price = 10;

Set Color

vue
<hy-price :text="price" color="#9CC53D"></hy-price>
ts
import { HyPrice } from '@hy-app/ui';

const price = 10;

Set Size

vue
<hy-price :text="price" :size="20"></hy-price>
ts
import { HyPrice } from '@hy-app/ui';

const price = 10;

Keep Decimal Places

vue
<hy-price :text="price" :num="6"></hy-price>
ts
import { HyPrice } from '@hy-app/ui';

const price = 10;

Set Prefix Symbol

vue
<hy-price :text="price" symbol="$"></hy-price>
ts
import { HyPrice } from '@hy-app/ui';

const price = 10;

Set Weight

vue
<hy-price :text="price" :weight="900"></hy-price>
ts
import { HyPrice } from '@hy-app/ui';

const price = 10;

Set Slant

vue
<hy-price :text="price" :slant="true"></hy-price>
ts
import { HyPrice } from '@hy-app/ui';

const price = 10;

Set Ratio

vue
<hy-price text="10.22" :ratio="1"></hy-price>
<hy-price text="10.22" :ratio="1.2"></hy-price>
<hy-price text="10.22"></hy-price>
<hy-price text="10.22" :ratio="1.6"></hy-price>
ts
import { HyPrice } from 'hy-app';

API

Price Props

ParameterDescriptionTypeDefault
textAmount valuestring | number0.00
symbolCurrency symbolstring
ratioScale rationumber1.4
numNumber of decimal places to retainnumber2
colorFont colorstring#FE3232
sizeFont size; numeric values default to pxstring | number12
weightFont weightnumber500
slantWhether to slantbooleanfalse
customStyleCustom external styles to be appliedCSSProperties-
customClassCustom external class namestring-

Events

Event NameDescriptionCallback Parameters
clickClick on the amounttext: amount value
01:10