Skip to content

Commit eaa1c1a

Browse files
committed
fix(countdown): 判断是否补0
1 parent 3933a24 commit eaa1c1a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/packages/countdown/countdown.taro.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { View } from '@tarojs/components'
1010
import { ComponentDefaults } from '@/utils/typings'
1111
import { padZero } from '@/utils/pad-zero'
1212
import { web } from '@/utils/platform-taro'
13+
import { CountDownProps } from './types'
1314

1415
interface CountDownTimeProps {
1516
d: number
@@ -289,7 +290,7 @@ const InternalCountDown: ForwardRefRenderFunction<
289290
[`${classPrefix}-number-text`]: type === 'text',
290291
})}
291292
>
292-
{padZero(time)}
293+
{unit ? padZero(time) : time}
293294
</View>
294295
{unit ? (
295296
<View className={`${classPrefix}-unit`}>{getUnit(unit)}</View>
@@ -321,7 +322,7 @@ const InternalCountDown: ForwardRefRenderFunction<
321322
'S',
322323
padZero(ms, 3)
323324
.toString()
324-
.slice(0, digit || 2)
325+
.slice(0, digit || 1)
325326
)}
326327
</>
327328
)

0 commit comments

Comments
 (0)