JS实现数字千分位分割: function toThousands(num) { return (num || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'); }