whyczyk
2021-08-31 46836333f0f884f282e6e628d8ac7f35a3b0402f
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