diff --git a/code/Solutions/Tools/ArkTSClock/entry/src/main/ets/pages/Index.ets b/code/Solutions/Tools/ArkTSClock/entry/src/main/ets/pages/Index.ets index ba566d7cb..8a807a491 100644 --- a/code/Solutions/Tools/ArkTSClock/entry/src/main/ets/pages/Index.ets +++ b/code/Solutions/Tools/ArkTSClock/entry/src/main/ets/pages/Index.ets @@ -20,6 +20,7 @@ const HOURS: Array = ['3', '4', '5', '6', '7', '8', '9', '10', '11', '12 const HEIGHT_ADD: number = 150 // 表盘下面需要绘制时间,canvas高度是宽度加150 const TAG: string = 'Index' const DELAY: number = 600000; +const UPDATE_DELAY: number = 1000; @Entry @Component @@ -56,6 +57,12 @@ struct Clock { this.getSize() } + onPageShow() { + Logger.info(TAG, `onPageShow`); + this.updateTime(); + this.intervalId = setInterval(this.updateTime, UPDATE_DELAY); + } + // 获取设备宽高计算表盘大小 async getSize() { let mDisplay = await display.getDefaultDisplay()