Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
b0ab2982
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
b0ab2982
编写于
8月 08, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 08, 2022
浏览文件
操作
浏览文件
下载
差异文件
!7851 【轻量级 PR】:【openHarmony开源贡献者计划2022】修改TextClock描述及代码格式
Merge pull request !7851 from 汪元白/N/A
上级
907cc75b
f735c479
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
23 deletion
+23
-23
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textclock.md
...n-dev/reference/arkui-ts/ts-basic-components-textclock.md
+23
-23
未找到文件。
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textclock.md
浏览文件 @
b0ab2982
...
...
@@ -21,7 +21,7 @@ TextClock(options?: { timeZoneOffset?: number, controller?: TextClockController
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------- | -------- | ---- | ------------------ | ------------------------------------------------------------ |
| timeZoneOffset | number | 否 |
时区偏移量 | 设置时区偏移量。
<br>
取值范围为[-14:00, 12:00],表示东十二区到西十二区,其中负值表示东时区,正值表示西时区,比如东八区为-8:00。
<br>
对横跨国际日界线的国家或地区,用-13:00(UTC+13)和-14:00(UTC+14)来保证整个国家或者区域处在相同的时间
。 |
| timeZoneOffset | number | 否 |
当前系统的时区偏移量 | 设置时区偏移量。
<br>
取值范围为[-14, 12],表示东十二区到西十二区,其中负值表示东时区,正值表示西时区,比如东八区为-8。
<br>
对横跨国际日界线的国家或地区,用-13(UTC+13)和-14(UTC+14)来保证整个国家或者区域处在相同的时间,当设置的值不在取值范围内时,将使用当前系统的时区偏移量
。 |
| contorller |
[
TextClockContorller
](
#textclockcontroller
)
| 否 | null | 绑定一个控制器,用来控制文本时钟的状态。|
## 属性
...
...
@@ -30,7 +30,7 @@ TextClock(options?: { timeZoneOffset?: number, controller?: TextClockController
| 名称 | 参数类型 | 默认值 | 描述 |
| ------ | -------- | -------- | ------------------------------------------------------------ |
| format | string | 'h
hmmss' | 设置显示时间格式,如“yyyy/mm/dd”、“yyyy-mm-dd”等。
<br>
支持的时间格式化字符串:
<br>
- yyyy:年份。
<br/>
- mm:英文月份简写。
<br/>
- mmm:英文月份简写。
<br/>
- mmmm:英文月份全称。
<br/>
- dd:英文星期简写。
<br/>
- ddd:英文星期简写。
<br/>
- dddd:英文星期全称。
<br/>
- HH:24小时制。
<br/>
- hh:12小时制。
<br/>
- MM/mm:分钟。
<br/>
- SS/ss:秒。
|
| format | string | 'h
ms' | 设置显示时间格式。
<br/>
日期间隔符固定为"/",时间间隔符为":"。
<br/>
如yyyyMMdd,yyyy-MM-dd显示为yyyy/MM/dd,
<br/>
hhmmss显示为hh:mm:ss。
<br/>
时间格式只用写一位即可,如"hhmmss"等同于"hms"。
<br/>
支持的时间格式化字符串:
<br/>
- YYYY/yyyy:完整年份。
<br/>
- YY/yy:年份后两位。
<br/>
- M:月份(若想使用01月则使用MM)。
<br/>
- d:日期(若想使用01日则使用dd)。
<br/>
- D:年中日(一年中的第几天)。
<br/>
- H:24小时制。
<br/>
- h:12小时制。
<br/>
- m:分钟。
<br/>
- s:秒。
<br/>
- 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
(
'
hhmms
s
'
)
.
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
(
'
hm
s
'
)
.
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%
'
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录