添加地址功能:手机号需要添加正则验证
This commit is contained in:
15
utils/index.js
Normal file
15
utils/index.js
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* 金额格式化
|
||||
* @param {*} amount 金额
|
||||
* @returns
|
||||
*/
|
||||
export const formatRMB = amount => {
|
||||
const formatted = new Intl.NumberFormat('zh-CN', {
|
||||
style: 'currency',
|
||||
currency: 'CNY',
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2
|
||||
}).format(amount)
|
||||
|
||||
return formatted.replace(/^[¥\s]+/, '') // 移除开头的 ¥ 和可能的空格
|
||||
}
|
||||
Reference in New Issue
Block a user