function toDecimalFromJSON(v, record) { v = Ext.num(v, 0); // ensure v is a valid numeric value, otherwise use 0 as a base (fixes $NaN.00 appearing in summaryRow when no records exist) v = (Math.round((v - 0) * 100)) / 100; v = (v == Math.floor(v)) ? v + "" : ((v * 10 == Math.floor(v * 10)) ? v + "0" : v); v = String(v); var ps = v.split('.'); var whole = ps[0]; var sub = ps[1] ? '.'+ ps[1] : ''; var r = /(\d+)(\d{3})/; while (r.test(whole)) { whole = whole.replace(r, '$1' + ',' + '$2'); } v = whole + sub; if (v.charAt(0) == '-') { return '-¥ ' + v.substr(1); } return "RMB " + v +" 元"; }
sencha touch中 转换 数字转换人民币的方法
最新推荐文章于 2021-06-09 23:07:32 发布