代码 /** * 大数字转换,将大额数字转换为万.千万.亿等 * @param value 数字值 */ export function bigNumberTransform (value) { const newValue = ['', '', ''] let fr = 1000 let num = 3 let text1 = '' let fm = 1 while (value / fr >= 1) { fr *= 10 num += 1 // console.log('数字', value
function unitConvert(num) { var moneyUnits = ["元", "万元", "亿元", "万亿"] var dividend = 10000; var curentNum = num; //转换数字 var curentUnit = moneyUnits[0]; //转换单位 for (var i = 0; i <4; i++) { curentUnit = moneyUnits[i
function DX(n) { if (!/^(0|[1-9]\d*)(\.\d+)?$/.test(n)) return "数据非法"; var unit = "千百拾亿千百拾万千百拾元角分", str = ""; n += "00"; var p = n.indexOf('.'); if (p >= 0
js处理数值和日期本地化 const s = new Intl.NumberFormat('zh-cn'); s.format(111.111) // "111.111" const s = new Intl.NumberFormat('zh-cn', {style: 'currency', currency: 'CNY'}); s.format(111.111) // "¥111.11" const s = new Intl.DateTimeFormat('zh-