computeLen1(number) { let ret = '' if (number !== '' && number != null && number !== '0') { let unit = '仟佰拾亿仟佰拾万仟佰拾元角分' let str = '' number += '00' const point = number.indexOf('.') if (point >= 0) { number = number.substring(0, point) + number.substr(point + 1, 2) } unit = unit.substr(unit.length - number.length) for (let i = 0; i < number.length; i++) { str += '零壹贰叁肆伍陆柒捌玖'.charAt(number.charAt(i)) + unit.charAt(i) } ret = str .replace(/零(仟|佰|拾|角)/g, '零') .replace(/(零)+/g, '零') .replace(/零(万|亿|元)/g, '$1') .replace(/(亿)万|(拾)/g, '$1$2') .replace(/^元零?|零分/g, '') .replace(/元$/g, '元') + '整' } this.jine = ret },
将金额传入方法
标签:中文,数字,point,number,大写,replace,let,ret,unit From: https://www.cnblogs.com/alannero/p/17107768.html