Files
bbq/src/app/shared/utils/yuan.ts
2021-11-26 16:34:35 +08:00

12 lines
313 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 转化成RMB元字符串
*
* @param digits 当数字类型时允许指定小数点后数字的个数默认2位小数
*/
export function yuan(value: number | string, digits: number = 2): string {
if (typeof value === 'number') {
value = value.toFixed(digits);
}
return `&yen ${value}`;
}