whyczyk
2021-10-28 31df8a64d5e9d454ceadc4602d344f9b47b65a63
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