Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
1b24a1a1
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看板
提交
1b24a1a1
编写于
11月 21, 2022
作者:
L
luoying_ace_admin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
revise doc
Signed-off-by:
N
luoying_ace_admin
<
luoying19@huawei.com
>
上级
4b4f0f9c
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
383 addition
and
247 deletion
+383
-247
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md
...v/reference/arkui-ts/ts-basic-components-checkboxgroup.md
+11
-11
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md
...n-dev/reference/arkui-ts/ts-basic-components-datapanel.md
+34
-6
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-marquee.md
...ion-dev/reference/arkui-ts/ts-basic-components-marquee.md
+23
-22
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-navigation.md
...-dev/reference/arkui-ts/ts-basic-components-navigation.md
+73
-104
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-rating.md
...tion-dev/reference/arkui-ts/ts-basic-components-rating.md
+41
-11
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-stepper.md
...ion-dev/reference/arkui-ts/ts-basic-components-stepper.md
+30
-22
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textarea.md
...on-dev/reference/arkui-ts/ts-basic-components-textarea.md
+12
-6
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md
...tion-dev/reference/arkui-ts/ts-basic-components-toggle.md
+14
-15
zh-cn/application-dev/reference/arkui-ts/ts-container-tabcontent.md
...ication-dev/reference/arkui-ts/ts-container-tabcontent.md
+109
-32
zh-cn/application-dev/reference/arkui-ts/ts-container-tabs.md
...n/application-dev/reference/arkui-ts/ts-container-tabs.md
+35
-17
zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-size.md
...on-dev/reference/arkui-ts/ts-universal-attributes-size.md
+1
-1
未找到文件。
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md
浏览文件 @
1b24a1a1
...
...
@@ -69,42 +69,42 @@ struct CheckboxExample {
// 全选按钮
Flex
({
justifyContent
:
FlexAlign
.
Start
,
alignItems
:
ItemAlign
.
Center
})
{
CheckboxGroup
({
group
:
'
checkboxGroup
'
})
.
selectedColor
(
0xed6f21
)
.
selectedColor
(
'
#007DFF
'
)
.
onChange
((
itemName
:
CheckboxGroupResult
)
=>
{
console
.
info
(
"
checkbox group content
"
+
JSON
.
stringify
(
itemName
))
})
Text
(
'
Select All
'
).
fontSize
(
2
0
)
Text
(
'
Select All
'
).
fontSize
(
14
).
lineHeight
(
20
).
fontColor
(
'
#182431
'
).
fontWeight
(
50
0
)
}
// 选项1
Flex
({
justifyContent
:
FlexAlign
.
Start
,
alignItems
:
ItemAlign
.
Center
})
{
Checkbox
({
name
:
'
checkbox1
'
,
group
:
'
checkboxGroup
'
})
.
selectedColor
(
0x39a2db
)
.
selectedColor
(
'
#007DFF
'
)
.
onChange
((
value
:
boolean
)
=>
{
console
.
info
(
'
Checkbox1 change is
'
+
value
)
})
Text
(
'
Checkbox1
'
).
fontSize
(
2
0
)
}
Text
(
'
Checkbox1
'
).
fontSize
(
14
).
lineHeight
(
20
).
fontColor
(
'
#182431
'
).
fontWeight
(
50
0
)
}
.
margin
({
left
:
36
})
// 选项2
Flex
({
justifyContent
:
FlexAlign
.
Start
,
alignItems
:
ItemAlign
.
Center
})
{
Checkbox
({
name
:
'
checkbox2
'
,
group
:
'
checkboxGroup
'
})
.
selectedColor
(
0x39a2db
)
.
selectedColor
(
'
#007DFF
'
)
.
onChange
((
value
:
boolean
)
=>
{
console
.
info
(
'
Checkbox2 change is
'
+
value
)
})
Text
(
'
Checkbox2
'
).
fontSize
(
2
0
)
}
Text
(
'
Checkbox2
'
).
fontSize
(
14
).
lineHeight
(
20
).
fontColor
(
'
#182431
'
).
fontWeight
(
50
0
)
}
.
margin
({
left
:
36
})
// 选项3
Flex
({
justifyContent
:
FlexAlign
.
Start
,
alignItems
:
ItemAlign
.
Center
})
{
Checkbox
({
name
:
'
checkbox3
'
,
group
:
'
checkboxGroup
'
})
.
selectedColor
(
0x39a2db
)
.
selectedColor
(
'
#007DFF
'
)
.
onChange
((
value
:
boolean
)
=>
{
console
.
info
(
'
Checkbox3 change is
'
+
value
)
})
Text
(
'
Checkbox3
'
).
fontSize
(
2
0
)
}
Text
(
'
Checkbox3
'
).
fontSize
(
14
).
lineHeight
(
20
).
fontColor
(
'
#182431
'
).
fontWeight
(
50
0
)
}
.
margin
({
left
:
36
})
}
}
}
...
...
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md
浏览文件 @
1b24a1a1
...
...
@@ -41,15 +41,43 @@ DataPanel(options:{values: number[], max?: number, type?: DataPanelType})
@
Entry
@
Component
struct
DataPanelExample
{
public
value
s1
:
number
[]
=
[
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
]
public
value
Arr
:
number
[]
=
[
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
]
build
()
{
Column
({
space
:
5
})
{
Text
(
'
Circle
'
).
fontSize
(
9
).
fontColor
(
0xCCCCCC
).
margin
({
top
:
20
,
right
:
'
80%
'
})
DataPanel
({
values
:
this
.
values1
,
max
:
100
,
type
:
DataPanelType
.
Circle
}).
width
(
200
).
height
(
200
)
Text
(
'
Line
'
).
fontSize
(
9
).
fontColor
(
0xCCCCCC
).
margin
({
bottom
:
20
,
right
:
'
80%
'
})
DataPanel
({
values
:
this
.
values1
,
max
:
100
,
type
:
DataPanelType
.
Line
}).
width
(
300
).
height
(
10
)
Row
()
{
Stack
()
{
DataPanel
({
values
:
[
25
],
max
:
100
,
type
:
DataPanelType
.
Circle
}).
width
(
168
).
height
(
168
)
Column
()
{
Text
(
'
30
'
).
fontSize
(
35
).
fontColor
(
'
#182431
'
)
Text
(
'
1.0.0
'
).
fontSize
(
9.33
).
lineHeight
(
12.83
).
fontWeight
(
500
).
opacity
(
0.6
)
}
Text
(
'
%
'
)
.
fontSize
(
9.33
)
.
lineHeight
(
12.83
)
.
fontWeight
(
500
)
.
opacity
(
0.6
)
.
position
({
x
:
104.42
,
y
:
78.17
})
}.
margin
({
right
:
44
})
Stack
()
{
DataPanel
({
values
:
[
50
,
12
,
8
,
5
],
max
:
100
,
type
:
DataPanelType
.
Circle
}).
width
(
168
).
height
(
168
)
Column
()
{
Text
(
'
75
'
).
fontSize
(
35
).
fontColor
(
'
#182431
'
)
Text
(
'
已使用98GB/128GB
'
).
fontSize
(
8.17
).
lineHeight
(
11.08
).
fontWeight
(
500
).
opacity
(
0.6
)
}
Text
(
'
%
'
)
.
fontSize
(
9.33
)
.
lineHeight
(
12.83
)
.
fontWeight
(
500
)
.
opacity
(
0.6
)
.
position
({
x
:
104.42
,
y
:
78.17
})
}
}.
margin
({
bottom
:
59
})
DataPanel
({
values
:
this
.
valueArr
,
max
:
100
,
type
:
DataPanelType
.
Line
}).
width
(
300
).
height
(
10
)
}.
width
(
'
100%
'
).
margin
({
top
:
5
})
}
}
...
...
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-marquee.md
浏览文件 @
1b24a1a1
...
...
@@ -51,10 +51,10 @@ Marquee(value: { start: boolean, step?: number, loop?: number, fromStart?: boole
@
Component
struct
MarqueeExample
{
@
State
start
:
boolean
=
false
@
St
ate
fromStart
:
boolean
=
true
@
St
ate
step
:
number
=
50
@
State
loop
:
number
=
3
@
St
ate
src
:
string
=
"
Running Marquee starts rolling
"
priv
ate
fromStart
:
boolean
=
true
priv
ate
step
:
number
=
50
private
loop
:
number
=
Infinity
priv
ate
src
:
string
=
"
Running Marquee starts rolling
"
build
()
{
Flex
({
direction
:
FlexDirection
.
Column
,
alignItems
:
ItemAlign
.
Center
,
justifyContent
:
FlexAlign
.
Center
})
{
...
...
@@ -65,29 +65,31 @@ struct MarqueeExample {
fromStart
:
this
.
fromStart
,
src
:
this
.
src
})
.
width
(
40
0
)
.
fontColor
(
Color
.
White
)
.
font
Size
(
50
)
.
allowScale
(
false
)
.
fontWeight
(
FontWeight
.
Bold
)
.
backgroundColor
(
Color
.
Black
)
.
margin
({
bottom
:
40
})
.
width
(
36
0
)
.
height
(
80
)
.
font
Color
(
'
#FFFFFF
'
)
.
fontSize
(
48
)
.
fontWeight
(
700
)
.
backgroundColor
(
'
#182431
'
)
.
margin
({
bottom
:
40
})
.
onStart
(()
=>
{
console
.
log
(
'
Marquee animation complete onStart
'
)
console
.
info
(
'
Marquee animation complete onStart
'
)
})
.
onBounce
(()
=>
{
console
.
log
(
'
Marquee animation complete onBounce
'
)
console
.
info
(
'
Marquee animation complete onBounce
'
)
})
.
onFinish
(()
=>
{
console
.
log
(
'
Marquee animation complete onFinish
'
)
console
.
info
(
'
Marquee animation complete onFinish
'
)
})
Button
(
'
start
'
)
.
onClick
(()
=>
{
this
.
start
=
true
})
.
width
(
200
)
.
height
(
60
)
.
margin
({
bottom
:
20
})
Button
(
'
Start
'
)
.
onClick
(()
=>
{
this
.
start
=
true
})
.
width
(
120
)
.
height
(
40
)
.
fontSize
(
16
)
.
fontWeight
(
500
)
.
backgroundColor
(
'
#007DFF
'
)
}
.
width
(
'
100%
'
)
.
height
(
'
100%
'
)
...
...
@@ -95,4 +97,3 @@ struct MarqueeExample {
}
```
![
zh-cn_image_0000001193499234
](
figures/zh-cn_image_0000001193499234.gif
)
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-navigation.md
浏览文件 @
1b24a1a1
...
...
@@ -119,143 +119,112 @@ Navigation()
@
Component
struct
NavigationExample
{
private
arr
:
number
[]
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
]
@
State
hideBar
:
boolean
=
true
@
Builder
NavigationTitle
()
{
Column
()
{
Text
(
'
title
'
)
.
width
(
80
)
.
height
(
60
)
.
fontColor
(
Color
.
Blue
)
.
fontSize
(
30
)
}
.
onClick
(()
=>
{
console
.
log
(
"
title
"
)
})
}
@
Builder
NavigationMenus
()
{
Row
()
{
Image
(
'
images/add.png
'
)
.
width
(
25
)
.
height
(
25
)
Image
(
'
comment/more.png
'
)
.
width
(
25
)
.
height
(
25
)
.
margin
({
left
:
30
})
}.
width
(
100
)
}
build
()
{
Column
()
{
Navigation
()
{
Search
({
value
:
''
,
placeholder
:
""
}).
width
(
'
85%
'
).
margin
(
26
)
List
({
space
:
5
,
initialIndex
:
0
})
{
ForEach
(
this
.
arr
,
(
item
)
=>
{
ListItem
()
{
Text
(
''
+
item
)
.
width
(
'
90%
'
)
.
height
(
80
)
.
backgroundColor
(
'
#3366CC
'
)
.
borderRadius
(
15
)
.
fontSize
(
16
)
.
textAlign
(
TextAlign
.
Center
)
}.
editable
(
true
)
},
item
=>
item
)
}
.
listDirection
(
Axis
.
Vertical
)
.
height
(
300
)
.
margin
({
top
:
10
,
left
:
18
})
.
width
(
'
100%
'
)
Button
(
this
.
hideBar
?
"
tool bar
"
:
"
hide bar
"
)
.
onClick
(()
=>
{
this
.
hideBar
=
!
this
.
hideBar
})
.
margin
({
left
:
135
,
top
:
60
})
}
.
title
(
this
.
NavigationTitle
)
.
subTitle
(
'
subtitle
'
)
.
menus
(
this
.
NavigationMenus
)
.
titleMode
(
NavigationTitleMode
.
Free
)
.
hideTitleBar
(
false
)
.
hideBackButton
(
false
)
.
onTitleModeChange
((
titleModel
:
NavigationTitleMode
)
=>
{
console
.
log
(
'
titleMode
'
)
})
.
toolBar
({
items
:
[
{
value
:
'
app
'
,
icon
:
'
images/grid.svg
'
,
action
:
()
=>
{
console
.
log
(
"
app
"
)
}
},
{
value
:
'
add
'
,
icon
:
'
images/add.svg
'
,
action
:
()
=>
{
console
.
log
(
"
add
"
)
}
},
{
value
:
'
collect
'
,
icon
:
'
images/collect.svg
'
,
action
:
()
=>
{
console
.
log
(
"
collect
"
)
}
}]
})
.
hideToolBar
(
this
.
hideBar
)
}
}
}
```
![
zh-cn_image_0000001237616085
](
figures/zh-cn_image_0000001237616085.gif
)
```
ts
// xxx.ets
@
Entry
@
Component
struct
ToolbarBuilderExample
{
@
State
currentIndex
:
number
=
0
@
State
Build
:
Array
<
Object
>
=
[
{
icon
:
$r
(
'
app.media.ic_public_add
'
),
icon_after
:
$r
(
'
app.media.ic_public_addcolor
'
),
text
:
'
add
'
,
num
:
0
},
{
icon
:
$r
(
'
app.media.ic_public_app
'
),
icon_after
:
$r
(
'
app.media.ic_public_appcolor
'
),
text
:
'
app
'
,
num
:
1
},
{
icon
:
$r
(
'
app.media.ic_public_collect
'
),
icon_after
:
$r
(
'
app.media.ic_public_collectcolor
'
),
text
:
'
collect
'
,
num
:
2
}
]
@
Builder
NavigationTitle
()
{
Column
()
{
Text
(
'
Title
'
)
.
fontColor
(
'
#182431
'
)
.
fontSize
(
30
)
.
lineHeight
(
41
)
.
fontWeight
(
700
)
Text
(
'
subtitle
'
)
.
fontColor
(
'
#182431
'
)
.
fontSize
(
14
)
.
lineHeight
(
19
)
.
opacity
(
0.4
)
.
margin
({
top
:
2
})
}.
alignItems
(
HorizontalAlign
.
Start
)
}
@
Builder
NavigationMenus
()
{
Row
()
{
Image
(
'
common/navigation_icon1.svg
'
)
.
width
(
24
)
.
height
(
24
)
Image
(
'
common/navigation_icon1.svg
'
)
.
width
(
24
)
.
height
(
24
)
.
margin
({
left
:
24
})
Image
(
'
common/navigation_icon2.svg
'
)
.
width
(
24
)
.
height
(
24
)
.
margin
({
left
:
24
})
}
}
@
Builder
NavigationToolbar
()
{
Row
()
{
ForEach
(
this
.
Build
,
item
=>
{
Column
()
{
Image
(
this
.
currentIndex
==
item
.
num
?
item
.
icon_after
:
item
.
icon
)
.
width
(
2
5
)
.
height
(
2
5
)
Image
(
this
.
currentIndex
==
item
.
num
?
'
common/public_icon_selected.svg
'
:
'
common/public_icon.svg
'
)
.
width
(
2
4
)
.
height
(
2
4
)
Text
(
item
.
text
)
.
fontColor
(
this
.
currentIndex
==
item
.
num
?
"
#ff7500
"
:
"
#000000
"
)
}
.
fontColor
(
this
.
currentIndex
==
item
.
num
?
'
#007DFF
'
:
'
#182431
'
)
.
fontSize
(
10
)
.
lineHeight
(
14
)
.
fontWeight
(
500
)
.
margin
({
top
:
3
})
}.
width
(
104
).
height
(
56
)
.
onClick
(()
=>
{
this
.
currentIndex
=
item
.
num
})
.
margin
({
left
:
70
})
})
}
}
.
margin
({
left
:
24
})
}
build
()
{
Column
()
{
Navigation
()
{
Flex
()
{
TextInput
({
placeholder
:
'
search...
'
})
.
width
(
336
)
.
height
(
40
)
.
backgroundColor
(
'
#FFFFFF
'
)
.
margin
({
top
:
8
,
left
:
12
})
List
({
space
:
12
,
initialIndex
:
0
})
{
ForEach
(
this
.
arr
,
(
item
)
=>
{
ListItem
()
{
Text
(
''
+
item
)
.
width
(
336
)
.
height
(
72
)
.
backgroundColor
(
'
#FFFFFF
'
)
.
borderRadius
(
24
)
.
fontSize
(
16
)
.
fontWeight
(
500
)
.
textAlign
(
TextAlign
.
Center
)
}.
editable
(
true
)
},
item
=>
item
)
}
.
height
(
324
)
.
width
(
'
100%
'
)
.
margin
({
top
:
12
,
left
:
12
})
}
.
title
(
this
.
NavigationTitle
)
.
menus
(
this
.
NavigationMenus
)
.
titleMode
(
NavigationTitleMode
.
Free
)
.
toolBar
(
this
.
NavigationToolbar
)
}
.
hideTitleBar
(
false
)
.
hideToolBar
(
false
)
.
onTitleModeChange
((
titleModel
:
NavigationTitleMode
)
=>
{
console
.
info
(
'
titleMode
'
+
titleModel
)
})
}.
width
(
'
100%
'
).
height
(
'
100%
'
).
backgroundColor
(
'
#F1F3F5
'
)
}
}
```
![
zh-cn_image_0000001192655288
](
figures/zh-cn_image_0000001192655288.gif
)
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-rating.md
浏览文件 @
1b24a1a1
...
...
@@ -47,19 +47,49 @@ Rating(options?: { rating: number, indicator?: boolean })
@
Entry
@
Component
struct
RatingExample
{
@
State
rating
:
number
=
1
@
State
indicator
:
boolean
=
false
@
State
rating
:
number
=
3.5
build
()
{
Flex
({
direction
:
FlexDirection
.
Column
,
alignItems
:
ItemAlign
.
Center
,
justifyContent
:
FlexAlign
.
SpaceBetween
})
{
Text
(
'
current score is
'
+
this
.
rating
).
fontSize
(
20
)
Rating
({
rating
:
this
.
rating
,
indicator
:
this
.
indicator
})
.
stars
(
5
)
.
stepSize
(
0.5
)
.
onChange
((
value
:
number
)
=>
{
this
.
rating
=
value
})
}.
width
(
350
).
height
(
200
).
padding
(
35
)
Column
()
{
Column
()
{
Rating
({
rating
:
this
.
rating
,
indicator
:
false
})
.
stars
(
5
)
.
stepSize
(
0.5
)
.
margin
({
top
:
24
})
.
onChange
((
value
:
number
)
=>
{
this
.
rating
=
value
})
Text
(
'
current score is
'
+
this
.
rating
)
.
fontSize
(
16
)
.
fontColor
(
'
rgba(24,36,49,0.60)
'
)
.
margin
({
top
:
16
})
}.
width
(
360
).
height
(
113
).
backgroundColor
(
'
#FFFFFF
'
).
margin
({
top
:
68
})
Row
()
{
Image
(
'
common/testImage.jpg
'
)
.
width
(
40
)
.
height
(
40
)
.
borderRadius
(
20
)
.
margin
({
left
:
24
})
Column
()
{
Text
(
'
Yue
'
)
.
fontSize
(
16
)
.
fontColor
(
'
#182431
'
)
.
fontWeight
(
500
)
Row
()
{
Rating
({
rating
:
3.5
,
indicator
:
true
}).
margin
({
top
:
1
,
right
:
8
})
Text
(
'
2021/06/02
'
)
.
fontSize
(
10
)
.
fontColor
(
'
#182431
'
)
}
}.
margin
({
left
:
12
}).
alignItems
(
HorizontalAlign
.
Start
)
Text
(
'
1st Floor
'
)
.
fontSize
(
10
)
.
fontColor
(
'
#182431
'
)
.
position
({
x
:
295
,
y
:
8
})
}.
width
(
360
).
height
(
56
).
backgroundColor
(
'
#FFFFFF
'
).
margin
({
top
:
64
})
}.
width
(
'
100%
'
).
height
(
'
100%
'
).
backgroundColor
(
'
#F1F3F5
'
)
}
}
```
...
...
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-stepper.md
浏览文件 @
1b24a1a1
...
...
@@ -45,6 +45,22 @@ Stepper(value?: { index?: number })
```
ts
// xxx.ets
@
Styles
function
itemStyle
()
{
.
width
(
336
)
.
height
(
621
)
.
margin
({
top
:
48
,
left
:
12
})
.
borderRadius
(
24
)
.
backgroundColor
(
'
#FFFFFF
'
)
}
@
Extend
(
Text
)
function
itemTextStyle
()
{
.
fontColor
(
'
#182431
'
)
.
fontSize
(
36
)
.
fontWeight
(
500
)
.
opacity
(
0.4
)
.
margin
({
top
:
82
,
bottom
:
40
})
}
@
Entry
@
Component
struct
StepperExample
{
...
...
@@ -61,15 +77,13 @@ struct StepperExample {
StepperItem
()
{
Column
()
{
Text
(
'
Page One
'
)
.
fontSize
(
35
)
.
fontColor
(
Color
.
Blue
)
.
lineHeight
(
50
)
.
margin
({
top
:
250
,
bottom
:
50
})
.
itemTextStyle
()
Button
(
'
change status:
'
+
this
.
firstState
)
.
backgroundColor
(
'
#007dFF
'
)
.
onClick
(()
=>
{
this
.
firstState
=
this
.
firstState
===
ItemState
.
Skip
?
ItemState
.
Normal
:
ItemState
.
Skip
})
}.
width
(
'
100%
'
)
}.
itemStyle
(
)
}
.
nextLabel
(
'
Next
'
)
.
status
(
this
.
firstState
)
...
...
@@ -77,15 +91,13 @@ struct StepperExample {
StepperItem
()
{
Column
()
{
Text
(
'
Page Two
'
)
.
fontSize
(
35
)
.
fontColor
(
Color
.
Blue
)
.
lineHeight
(
50
)
.
margin
({
top
:
250
,
bottom
:
50
})
.
itemTextStyle
()
Button
(
'
change status:
'
+
this
.
secondState
)
.
backgroundColor
(
'
#007dFF
'
)
.
onClick
(()
=>
{
this
.
secondState
=
this
.
secondState
===
ItemState
.
Disabled
?
ItemState
.
Normal
:
ItemState
.
Disabled
})
}.
width
(
'
100%
'
)
}.
itemStyle
(
)
}
.
nextLabel
(
'
Next
'
)
.
prevLabel
(
'
Previous
'
)
...
...
@@ -94,29 +106,25 @@ struct StepperExample {
StepperItem
()
{
Column
()
{
Text
(
'
Page Three
'
)
.
fontSize
(
35
)
.
fontColor
(
Color
.
Blue
)
.
lineHeight
(
50
)
.
margin
({
top
:
250
,
bottom
:
50
})
.
itemTextStyle
()
Button
(
'
change status:
'
+
this
.
thirdState
)
.
backgroundColor
(
'
#007dFF
'
)
.
onClick
(()
=>
{
this
.
thirdState
=
this
.
thirdState
===
ItemState
.
Waiting
?
ItemState
.
Normal
:
ItemState
.
Waiting
})
}.
width
(
'
100%
'
)
}.
itemStyle
(
)
}
.
status
(
this
.
thirdState
)
// 第四个步骤页
StepperItem
()
{
Text
(
'
Page four
'
)
.
fontSize
(
35
)
.
fontColor
(
Color
.
Blue
)
.
width
(
'
100%
'
)
.
textAlign
(
TextAlign
.
Center
)
.
lineHeight
(
50
)
.
margin
({
top
:
250
})
Column
()
{
Text
(
'
Page four
'
)
.
itemTextStyle
()
}.
itemStyle
()
}
.
nextLabel
(
'
Finish
'
)
}
.
backgroundColor
(
'
#F1F3F5
'
)
.
onFinish
(()
=>
{
// 此处可处理点击最后一页的Finish时的逻辑,例如路由跳转等
console
.
info
(
'
onFinish
'
)
...
...
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textarea.md
浏览文件 @
1b24a1a1
...
...
@@ -85,23 +85,29 @@ struct TextAreaExample {
build
()
{
Column
()
{
TextArea
({
placeholder
:
'
The text area can hold an unlimited amount of text. input your word
'
,
controller
:
this
.
controller
})
.
placeholderFont
({
size
:
14
,
weight
:
400
})
.
width
(
400
)
.
height
(
50
)
TextArea
({
placeholder
:
'
The text area can hold an unlimited amount of text. input your word...
'
,
controller
:
this
.
controller
})
.
placeholderFont
({
size
:
16
,
weight
:
400
})
.
width
(
336
)
.
height
(
56
)
.
margin
(
20
)
.
fontSize
(
14
)
.
fontSize
(
16
)
.
fontColor
(
'
#182431
'
)
.
backgroundColor
(
'
#FFFFFF
'
)
.
onChange
((
value
:
string
)
=>
{
this
.
text
=
value
})
Text
(
this
.
text
)
Button
(
'
Set caretPosition 1
'
)
.
backgroundColor
(
'
#007DFF
'
)
.
margin
(
15
)
.
onClick
(()
=>
{
// 设置光标位置到第一个字符后
this
.
controller
.
caretPosition
(
1
)
})
}.
width
(
'
100%
'
)
}.
width
(
'
100%
'
)
.
height
(
'
100%
'
).
backgroundColor
(
'
#F1F3F5
'
)
}
}
```
...
...
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md
浏览文件 @
1b24a1a1
...
...
@@ -57,21 +57,20 @@ Toggle(options: { type: ToggleType, isOn?: boolean })
@
Entry
@
Component
struct
ToggleExample
{
build
()
{
Column
({
space
:
10
})
{
Text
(
'
type: Switch
'
).
fontSize
(
12
).
fontColor
(
0xcccccc
).
width
(
'
90%
'
)
Flex
({
justifyContent
:
FlexAlign
.
SpaceEvenly
,
alignItems
:
ItemAlign
.
Center
})
{
Toggle
({
type
:
ToggleType
.
Switch
,
isOn
:
false
})
.
selectedColor
(
0xed6f21
)
.
switchPointColor
(
0xe5ffffff
)
.
selectedColor
(
'
#007DFF
'
)
.
switchPointColor
(
'
#FFFFFF
'
)
.
onChange
((
isOn
:
boolean
)
=>
{
console
.
info
(
'
Component status:
'
+
isOn
)
})
Toggle
({
type
:
ToggleType
.
Switch
,
isOn
:
true
})
.
selectedColor
(
0x39a2db
)
.
switchPointColor
(
0xe5ffffff
)
.
selectedColor
(
'
#007DFF
'
)
.
switchPointColor
(
'
#FFFFFF
'
)
.
onChange
((
isOn
:
boolean
)
=>
{
console
.
info
(
'
Component status:
'
+
isOn
)
})
...
...
@@ -80,15 +79,15 @@ struct ToggleExample {
Text
(
'
type: Checkbox
'
).
fontSize
(
12
).
fontColor
(
0xcccccc
).
width
(
'
90%
'
)
Flex
({
justifyContent
:
FlexAlign
.
SpaceEvenly
,
alignItems
:
ItemAlign
.
Center
})
{
Toggle
({
type
:
ToggleType
.
Checkbox
,
isOn
:
false
})
.
size
({
width
:
2
8
,
height
:
28
})
.
selectedColor
(
0xed6f21
)
.
size
({
width
:
2
0
,
height
:
20
})
.
selectedColor
(
'
#007DFF
'
)
.
onChange
((
isOn
:
boolean
)
=>
{
console
.
info
(
'
Component status:
'
+
isOn
)
})
Toggle
({
type
:
ToggleType
.
Checkbox
,
isOn
:
true
})
.
size
({
width
:
2
8
,
height
:
28
})
.
selectedColor
(
0x39a2db
)
.
size
({
width
:
2
0
,
height
:
20
})
.
selectedColor
(
'
#007DFF
'
)
.
onChange
((
isOn
:
boolean
)
=>
{
console
.
info
(
'
Component status:
'
+
isOn
)
})
...
...
@@ -97,17 +96,17 @@ struct ToggleExample {
Text
(
'
type: Button
'
).
fontSize
(
12
).
fontColor
(
0xcccccc
).
width
(
'
90%
'
)
Flex
({
justifyContent
:
FlexAlign
.
SpaceEvenly
,
alignItems
:
ItemAlign
.
Center
})
{
Toggle
({
type
:
ToggleType
.
Button
,
isOn
:
false
})
{
Text
(
'
status button
'
).
padding
({
left
:
12
,
right
:
12
}
)
}
.
selectedColor
(
0xed6f21
)
Text
(
'
status button
'
).
fontColor
(
'
#182431
'
).
fontSize
(
12
)
}
.
width
(
106
)
.
selectedColor
(
'
rgba(0,125,255,0.20)
'
)
.
onChange
((
isOn
:
boolean
)
=>
{
console
.
info
(
'
Component status:
'
+
isOn
)
})
Toggle
({
type
:
ToggleType
.
Button
,
isOn
:
true
})
{
Text
(
'
status button
'
).
padding
({
left
:
12
,
right
:
12
}
)
}
.
selectedColor
(
0x39a2db
)
Text
(
'
status button
'
).
fontColor
(
'
#182431
'
).
fontSize
(
12
)
}
.
width
(
106
)
.
selectedColor
(
'
rgba(0,125,255,0.20)
'
)
.
onChange
((
isOn
:
boolean
)
=>
{
console
.
info
(
'
Component status:
'
+
isOn
)
})
...
...
zh-cn/application-dev/reference/arkui-ts/ts-container-tabcontent.md
浏览文件 @
1b24a1a1
...
...
@@ -33,84 +33,161 @@ TabContent()
## 示例
示例1:
```
ts
// xxx.ets
@
Entry
@
Component
struct
TabContentExample
{
@
State
fontColor
:
string
=
'
rgba(0, 0, 0, 0.4)
'
@
State
selectedFontColor
:
string
=
'
rgba(10, 30, 255, 1)
'
@
State
fontColor
:
string
=
'
#182431
'
@
State
selectedFontColor
:
string
=
'
#007DFF
'
@
State
currentIndex
:
number
=
0
private
controller
:
TabsController
=
new
TabsController
()
@
Builder
TabBuilder
(
index
:
number
)
{
Column
()
{
Image
(
this
.
currentIndex
===
index
?
'
/
resources/ic_public_contacts_filled_selected.png
'
:
'
/resources/ic_public_contacts_filled.pn
g
'
)
Image
(
this
.
currentIndex
===
index
?
'
/
common/public_icon_on.svg
'
:
'
/common/public_icon_off.sv
g
'
)
.
width
(
24
)
.
height
(
24
)
.
margin
(
6
)
.
opacity
(
this
.
currentIndex
===
index
?
1
:
0.4
)
.
margin
({
bottom
:
4
})
.
objectFit
(
ImageFit
.
Contain
)
Text
(
`Tab
${
(
index
>
2
?
(
index
-
1
)
:
index
)
+
1
}
`
)
Text
(
`Tab
${
index
+
1
}
`
)
.
fontColor
(
this
.
currentIndex
===
index
?
this
.
selectedFontColor
:
this
.
fontColor
)
.
fontSize
(
10
)
.
fontWeight
(
500
)
.
lineHeight
(
14
)
}.
width
(
'
100%
'
)
}
@
Builder
AddBuilder
()
{
Column
()
{
Image
(
this
.
currentIndex
===
2
?
'
/resources/ic_public_add_norm_filled_selected.png
'
:
'
/resources/ic_public_add_norm_filled.png
'
)
.
width
(
this
.
currentIndex
===
2
?
26
:
24
)
.
height
(
this
.
currentIndex
===
2
?
26
:
24
)
.
opacity
(
this
.
currentIndex
===
2
?
1
:
0.4
)
.
objectFit
(
ImageFit
.
Contain
)
}.
width
(
'
100%
'
).
height
(
'
100%
'
).
justifyContent
(
FlexAlign
.
Center
)
}
build
()
{
Column
()
{
Tabs
({
barPosition
:
BarPosition
.
End
,
controller
:
this
.
controller
})
{
TabContent
()
{
Column
()
{
Text
(
'
Tab1
'
).
fontSize
(
32
)
Text
(
'
Tab1
'
)
.
fontSize
(
36
)
.
fontColor
(
'
#182431
'
)
.
fontWeight
(
500
)
.
opacity
(
0.4
)
.
margin
({
top
:
30
,
bottom
:
56.5
})
Divider
()
.
strokeWidth
(
0.5
)
.
color
(
'
#182431
'
)
.
opacity
(
0.05
)
}.
width
(
'
100%
'
)
}.
tabBar
(
this
.
TabBuilder
(
0
))
TabContent
()
{
Column
()
{
Text
(
'
Tab2
'
).
fontSize
(
32
)
Text
(
'
Tab2
'
)
.
fontSize
(
36
)
.
fontColor
(
'
#182431
'
)
.
fontWeight
(
500
)
.
opacity
(
0.4
)
.
margin
({
top
:
30
,
bottom
:
56.5
})
Divider
()
.
strokeWidth
(
0.5
)
.
color
(
'
#182431
'
)
.
opacity
(
0.05
)
}.
width
(
'
100%
'
)
}.
tabBar
(
this
.
TabBuilder
(
1
))
TabContent
()
{
Column
()
{
Text
(
'
Add
'
).
fontSize
(
32
)
Text
(
'
Tab3
'
)
.
fontSize
(
36
)
.
fontColor
(
'
#182431
'
)
.
fontWeight
(
500
)
.
opacity
(
0.4
)
.
margin
({
top
:
30
,
bottom
:
56.5
})
Divider
()
.
strokeWidth
(
0.5
)
.
color
(
'
#182431
'
)
.
opacity
(
0.05
)
}.
width
(
'
100%
'
)
}.
tabBar
(
this
.
AddBuilder
(
))
}.
tabBar
(
this
.
TabBuilder
(
2
))
TabContent
()
{
Column
()
{
Text
(
'
Tab3
'
).
fontSize
(
32
)
Text
(
'
Tab4
'
)
.
fontSize
(
36
)
.
fontColor
(
'
#182431
'
)
.
fontWeight
(
500
)
.
opacity
(
0.4
)
.
margin
({
top
:
30
,
bottom
:
56.5
})
Divider
()
.
strokeWidth
(
0.5
)
.
color
(
'
#182431
'
)
.
opacity
(
0.05
)
}.
width
(
'
100%
'
)
}.
tabBar
(
this
.
TabBuilder
(
3
))
TabContent
()
{
Column
()
{
Text
(
'
Tab4
'
).
fontSize
(
32
)
}.
width
(
'
100%
'
)
}.
tabBar
(
this
.
TabBuilder
(
4
))
}
.
vertical
(
false
)
.
barWidth
(
300
)
.
barHeight
(
56
)
.
onChange
((
index
:
number
)
=>
{
this
.
currentIndex
=
index
})
.
width
(
'
90%
'
)
.
backgroundColor
(
'
rgba(241, 243, 245, 0.95)
'
)
}.
width
(
'
100%
'
).
height
(
200
).
margin
({
top
:
15
})
.
width
(
360
)
.
height
(
190
)
.
backgroundColor
(
'
#F1F3F5
'
)
.
margin
({
top
:
38
})
}.
width
(
'
100%
'
)
}
}
```
![
tabContent
](
figures/tabContent.gif
)
\ No newline at end of file
示例2:
```
ts
// xxx.ets
@
Entry
@
Component
struct
TabContentExample
{
@
State
fontColor
:
string
=
'
#182431
'
@
State
selectedFontColor
:
string
=
'
#007DFF
'
@
State
currentIndex
:
number
=
0
private
controller
:
TabsController
=
new
TabsController
()
@
Builder
TabBuilder
(
index
:
number
)
{
Column
()
{
Image
(
this
.
currentIndex
===
index
?
'
/common/public_icon_on.svg
'
:
'
/common/public_icon_off.svg
'
)
.
width
(
24
)
.
height
(
24
)
.
margin
({
bottom
:
4
})
.
objectFit
(
ImageFit
.
Contain
)
Text
(
'
Tab
'
)
.
fontColor
(
this
.
currentIndex
===
index
?
this
.
selectedFontColor
:
this
.
fontColor
)
.
fontSize
(
10
)
.
fontWeight
(
500
)
.
lineHeight
(
14
)
}.
width
(
'
100%
'
).
height
(
'
100%
'
).
justifyContent
(
FlexAlign
.
Center
)
}
build
()
{
Column
()
{
Tabs
({
barPosition
:
BarPosition
.
Start
,
controller
:
this
.
controller
})
{
TabContent
()
.
tabBar
(
this
.
TabBuilder
(
0
))
TabContent
()
.
tabBar
(
this
.
TabBuilder
(
1
))
TabContent
()
.
tabBar
(
this
.
TabBuilder
(
2
))
TabContent
()
.
tabBar
(
this
.
TabBuilder
(
3
))
}
.
vertical
(
true
)
.
barWidth
(
96
)
.
barHeight
(
414
)
.
onChange
((
index
:
number
)
=>
{
this
.
currentIndex
=
index
})
.
width
(
96
)
.
height
(
414
)
.
backgroundColor
(
'
#F1F3F5
'
)
.
margin
({
top
:
52
})
}.
width
(
'
100%
'
)
}
}
```
zh-cn/application-dev/reference/arkui-ts/ts-container-tabs.md
浏览文件 @
1b24a1a1
...
...
@@ -91,41 +91,59 @@ changeIndex(value: number): void
@
Entry
@
Component
struct
TabsExample
{
@
State
fontColor
:
string
=
'
#182431
'
@
State
selectedFontColor
:
string
=
'
#007DFF
'
@
State
currentIndex
:
number
=
0
private
controller
:
TabsController
=
new
TabsController
()
@
Builder
TabBuilder
(
index
:
number
,
name
:
string
)
{
Column
()
{
Text
(
name
)
.
fontColor
(
this
.
currentIndex
===
index
?
this
.
selectedFontColor
:
this
.
fontColor
)
.
fontSize
(
16
)
.
fontWeight
(
this
.
currentIndex
===
index
?
500
:
400
)
.
lineHeight
(
22
)
.
margin
({
top
:
17
,
bottom
:
7
})
Divider
()
.
strokeWidth
(
2
)
.
color
(
'
#007DFF
'
)
.
opacity
(
this
.
currentIndex
===
index
?
1
:
0
)
}.
width
(
'
100%
'
)
}
build
()
{
Column
()
{
Tabs
({
barPosition
:
BarPosition
.
Start
,
controller
:
this
.
controller
})
{
TabContent
()
{
Column
().
width
(
'
100%
'
).
height
(
'
100%
'
).
backgroundColor
(
Color
.
Pink
)
}.
tabBar
(
'
pink
'
)
Column
().
width
(
'
100%
'
).
height
(
'
100%
'
).
backgroundColor
(
'
#00CB87
'
)
}.
tabBar
(
this
.
TabBuilder
(
0
,
'
green
'
)
)
TabContent
()
{
Column
().
width
(
'
100%
'
).
height
(
'
100%
'
).
backgroundColor
(
Color
.
Yellow
)
}.
tabBar
(
'
yellow
'
)
Column
().
width
(
'
100%
'
).
height
(
'
100%
'
).
backgroundColor
(
'
#007DFF
'
)
}.
tabBar
(
this
.
TabBuilder
(
1
,
'
blue
'
)
)
TabContent
()
{
Column
().
width
(
'
100%
'
).
height
(
'
100%
'
).
backgroundColor
(
Color
.
Blue
)
}.
tabBar
(
'
blue
'
)
Column
().
width
(
'
100%
'
).
height
(
'
100%
'
).
backgroundColor
(
'
#FFBF00
'
)
}.
tabBar
(
this
.
TabBuilder
(
2
,
'
yellow
'
)
)
TabContent
()
{
Column
().
width
(
'
100%
'
).
height
(
'
100%
'
).
backgroundColor
(
Color
.
Green
)
}.
tabBar
(
'
green
'
)
Column
().
width
(
'
100%
'
).
height
(
'
100%
'
).
backgroundColor
(
'
#E67C92
'
)
}.
tabBar
(
this
.
TabBuilder
(
3
,
'
pink
'
)
)
}
.
vertical
(
true
)
.
scrollable
(
true
)
.
vertical
(
false
)
.
barMode
(
BarMode
.
Fixed
)
.
barWidth
(
7
0
)
.
barHeight
(
150
)
.
barWidth
(
36
0
)
.
barHeight
(
56
)
.
animationDuration
(
400
)
.
onChange
((
index
:
number
)
=>
{
console
.
info
(
index
.
toString
())
this
.
currentIndex
=
index
})
.
width
(
'
90%
'
)
.
backgroundColor
(
0xF5F5F5
)
}.
width
(
'
100%
'
).
height
(
150
).
margin
({
top
:
5
})
.
width
(
360
)
.
height
(
296
)
.
margin
({
top
:
52
})
.
backgroundColor
(
'
#F1F3F5
'
)
}.
width
(
'
100%
'
)
}
}
```
![
zh-cn_image_0000001174264360
](
figures/zh-cn_image_0000001174264360.gif
)
zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-size.md
浏览文件 @
1b24a1a1
...
...
@@ -17,7 +17,7 @@
| size | {
<br/>
width?:
[Length](ts-types.md#length),
<br/>
height?:
[
Length
](
ts-types.md#length
)
<br/>
} | 设置高宽尺寸。 |
| padding |
[
Padding
](
ts-types.md#padding
)
\|
[
Length
](
ts-types.md#length
)
| 设置内边距属性。
<br/>
参数为Length类型时,四个方向内边距同时生效。
<br>
默认值:0
<br>
padding设置百分比时,上下左右内边距均以父容器的width作为基础值。 |
| margin |
[
Margin
](
ts-types.md#margin
)
\|
[
Length
](
ts-types.md#length
)
| 设置外边距属性。
<br/>
参数为Length类型时,四个方向外边距同时生效。
<br>
默认值:0
<br>
margin设置百分比时,上下左右外边距均以父容器的width作为基础值。|
| constraintSize | {
<br/>
minWidth?:
[Length](ts-types.md#length),
<br/>
maxWidth?:
[Length](ts-types.md#length),
<br/>
minHeight?:
[Length](ts-types.md#length),
<br/>
maxHeight?:
[
Length
](
ts-types.md#length
)
<br/>
} | 设置约束尺寸,组件布局时,进行尺寸范围限制。constraintSize的优先级高于Width和Height。
<br>
默认值:
<br>
{
<br/>
minWidth:
0,
<br/>
maxWidth:
Infinity,
<br/>
minHeight:
0,
<br/>
maxHeight:
Infinity
<br/>
} |
| constraintSize | {
<br/>
minWidth?:
[Length](ts-types.md#length),
<br/>
maxWidth?:
[Length](ts-types.md#length),
<br/>
minHeight?:
[Length](ts-types.md#length),
<br/>
maxHeight?:
[
Length
](
ts-types.md#length
)
<br/>
} | 设置约束尺寸,组件布局时,进行尺寸范围限制。constraintSize的优先级高于Width和Height。
若设置的minWidth大于maxWidth,则minWidth生效,minHeight与maxHeight同理。
<br>
默认值:
<br>
{
<br/>
minWidth:
0,
<br/>
maxWidth:
Infinity,
<br/>
minHeight:
0,
<br/>
maxHeight:
Infinity
<br/>
} |
| layoutWeight | number
\|
string | 父容器尺寸确定时,设置了layoutWeight属性的子元素与兄弟元素占主轴尺寸按照权重进行分配,忽略元素本身尺寸设置,表示自适应占满剩余空间。
<br>
**说明:**
<br/>
仅在Row/Column/Flex布局中生效。|
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录