loading...

js - 补零

String(this.formatZero(this.sumCount, 5));
formatZero(num: any, len: any) {
    if (String(num).length > len) return num;
    return (Array(len).join("0") + num).slice(-len);
  }
posted @ 2020-12-27 21:15  robinloveslife  阅读(82)  评论(0编辑  收藏  举报