From f735c4799e0db77e9345d36dabc7d0240bc0290a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=AA=E5=85=83=E7=99=BD?= <603970629@qq.com> Date: Mon, 8 Aug 2022 06:13:23 +0000 Subject: [PATCH] =?UTF-8?q?=E3=80=90openHarmony=E5=BC=80=E6=BA=90=E8=B4=A1?= =?UTF-8?q?=E7=8C=AE=E8=80=85=E8=AE=A1=E5=88=922022=E3=80=91=E4=BF=AE?= =?UTF-8?q?=E6=94=B9TextClock=E6=8F=8F=E8=BF=B0=E5=8F=8A=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=20=E4=BF=AE=E6=94=B9=E6=8F=8F=E8=BF=B0?= =?UTF-8?q?=E5=8F=8A=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangyuanbai <603970629@qq.com> --- .../arkui-ts/ts-basic-components-textclock.md | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textclock.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textclock.md index 6f80bffcac..9c36c5f32c 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textclock.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textclock.md @@ -21,7 +21,7 @@ TextClock(options?: { timeZoneOffset?: number, controller?: TextClockController | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | -------- | -------- | ---- | ------------------ | ------------------------------------------------------------ | -| timeZoneOffset | number | 否 | 时区偏移量 | 设置时区偏移量。
取值范围为[-14:00, 12:00],表示东十二区到西十二区,其中负值表示东时区,正值表示西时区,比如东八区为-8:00。
对横跨国际日界线的国家或地区,用-13:00(UTC+13)和-14:00(UTC+14)来保证整个国家或者区域处在相同的时间。 | +| timeZoneOffset | number | 否 | 当前系统的时区偏移量 | 设置时区偏移量。
取值范围为[-14, 12],表示东十二区到西十二区,其中负值表示东时区,正值表示西时区,比如东八区为-8。
对横跨国际日界线的国家或地区,用-13(UTC+13)和-14(UTC+14)来保证整个国家或者区域处在相同的时间,当设置的值不在取值范围内时,将使用当前系统的时区偏移量。 | | contorller | [TextClockContorller](#textclockcontroller) | 否 | null | 绑定一个控制器,用来控制文本时钟的状态。| ## 属性 @@ -30,7 +30,7 @@ TextClock(options?: { timeZoneOffset?: number, controller?: TextClockController | 名称 | 参数类型 | 默认值 | 描述 | | ------ | -------- | -------- | ------------------------------------------------------------ | -| format | string | 'hhmmss' | 设置显示时间格式,如“yyyy/mm/dd”、“yyyy-mm-dd”等。
支持的时间格式化字符串:
- yyyy:年份。
- mm:英文月份简写。
- mmm:英文月份简写。
- mmmm:英文月份全称。
- dd:英文星期简写。
- ddd:英文星期简写。
- dddd:英文星期全称。
- HH:24小时制。
- hh:12小时制。
- MM/mm:分钟。
- SS/ss:秒。 | +| format | string | 'hms' | 设置显示时间格式。
日期间隔符固定为"/",时间间隔符为":"。
如yyyyMMdd,yyyy-MM-dd显示为yyyy/MM/dd,
hhmmss显示为hh:mm:ss。
时间格式只用写一位即可,如"hhmmss"等同于"hms"。
支持的时间格式化字符串:
- YYYY/yyyy:完整年份。
- YY/yy:年份后两位。
- M:月份(若想使用01月则使用MM)。
- d:日期(若想使用01日则使用dd)。
- D:年中日(一年中的第几天)。
- H:24小时制。
- h:12小时制。
- m:分钟。
- s:秒。
- SSS:毫秒。| ## 事件 @@ -73,27 +73,27 @@ struct Second { controller: TextClockController = new TextClockController() build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center}) { - Text('Current milliseconds is ' + this.accumulateTime) - .fontSize(20) - // 以12小时制显示东八区的系统时间,精确到秒。 - TextClock({timeZoneOffset: -8, controller: this.controller}) - .format('hhmmss') - .onDateChange((value: number) => { - this.accumulateTime = value - }) - .margin(20) - .fontSize(30) - Button("start TextClock") - .margin({ bottom: 10 }) - .onClick(()=>{ - this.controller.start() - }) - Button("stop TextClock") - .onClick(()=>{ - this.controller.stop() - }) - } + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Current milliseconds is ' + this.accumulateTime) + .fontSize(20) + // 以12小时制显示东八区的系统时间,精确到秒。 + TextClock({ timeZoneOffset: -8, controller: this.controller }) + .format('hms') + .onDateChange((value: number) => { + this.accumulateTime = value + }) + .margin(20) + .fontSize(30) + Button("start TextClock") + .margin({ bottom: 10 }) + .onClick(() => { + this.controller.start() + }) + Button("stop TextClock") + .onClick(() => { + this.controller.stop() + }) + } .width('100%') .height('100%') } -- GitLab