2021-01-04 金额格式化
2021-01-04 本文已影响0人
流泪手心_521
formatAmount (val) {
if (!val) return ''
let arr = val.split('-')
let formateArr = arr.map(item => {
if (item >= 10000) {
return item / 10000 + '亿元'
} else {
return item + '万元'
}
})
return formateArr.join('-')
},
formatAmount (str) {
let amountStr = ''
if (str && str.indexOf('-')) {
let amountArr = str.split('-')
amountStr = amountArr.map(x => x + '万元').join('-')
} else {
amountStr = str ? str + '万元' : ''
}
return amountStr;
},