[new feature] add CountDown component (#3805)

This commit is contained in:
neverland
2019-07-10 20:20:59 +08:00
committed by GitHub
parent 577194b16d
commit 9fcc9086f7
16 changed files with 688 additions and 4 deletions
+8 -2
View File
@@ -4,6 +4,12 @@ export function camelize(str: string): string {
return str.replace(camelizeRE, (_, c) => c.toUpperCase());
}
export function padZero(num: number | string): string {
return (num < 10 ? '0' : '') + num;
export function padZero(num: number | string, targetLength = 2): string {
let str = num + '';
while (str.length < targetLength) {
str = '0' + str;
}
return str;
}