usePrice
Definition
Composable for getting formatted price
Basic usage
ts
const { init, getFormattedPrice } = usePrice();
Signature
ts
export function usePrice(): UsePriceReturn
Return type
See UsePriceReturn
ts
export type UsePriceReturn = {
/**
* Set init data: currencySymbol & currencyPosition
*/
init(options: { currencySymbol: string; currencyPosition: number }): void;
/**
* Format price i.e. (2) -> 2.00 $
*/
getFormattedPrice(value: number | string | undefined): string;
};
Methods
Name | Type | Description |
---|---|---|
init | void | Set init data: currencySymbol & currencyPosition |
getFormattedPrice | string | Format price i.e. (2) -> 2.00 $ |