export function currencyFormat(value: string | number) {
const toFixed = (+value).toFixed(2);
return `$ ${toFixed}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
}
例子:
export function currencyFormat(value: string | number) {
const toFixed = (+value).toFixed(2);
return `$ ${toFixed}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
}
例子: