1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| /**
| * 数字添加千分位
| */
| function toThousands(num) {
| var num = (num || 0).toString(),
| result = '';
| while (num.length > 3) {
| result = ',' + num.slice(-3) + result;
| num = num.slice(0, num.length - 3);
| }
| if (num) {
| result = num + result;
| }
| return result;
| }
| export default toThousands
|
|