Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
9b75aa52
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
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看板
未验证
提交
9b75aa52
编写于
10月 11, 2022
作者:
L
luoying_ace
提交者:
Gitee
10月 11, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update zh-cn/application-dev/reference/arkui-ts/ts-basic-components-stepper.md.
Signed-off-by:
N
luoying_ace
<
luoying19@huawei.com
>
上级
0e85d371
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
57 addition
and
49 deletion
+57
-49
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-stepper.md
...ion-dev/reference/arkui-ts/ts-basic-components-stepper.md
+57
-49
未找到文件。
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-stepper.md
浏览文件 @
9b75aa52
# Stepper
应用步骤方式切换页面的组件
。
步骤导航器组件,适用于引导用户按照步骤完成任务的导航场景
。
> **说明:**
...
...
@@ -8,8 +8,6 @@
> 该组件从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
## 子组件
仅能包含子组件
[
StepperItem
](
ts-basic-components-stepperitem.md
)
。
...
...
@@ -24,7 +22,7 @@ Stepper(value?: { index?: number })
| 参数名 | 参数类型 | 必填 | 参数描述 |
| ------| -------- | --------------- | -------- |
| index | number | 否 | 设置步骤导航器
显示第几个StepperItem
。
<br/>
默认值:0 |
| index | number | 否 | 设置步骤导航器
当前显示StepperItem的索引值
。
<br/>
默认值:0 |
## 属性
...
...
@@ -38,9 +36,9 @@ Stepper(value?: { index?: number })
| -------- | -------- |
| onFinish(callback:
()
=
>
void) | 步骤导航器最后一个StepperItem的nextLabel被点击时触发该回调
。 |
| onSkip(callback:
()
=
>
void) | 当前显示的StepperItem状态为ItemState.Skip时,nextLabel被点击时触发该回调。 |
| onChange(callback:
(prevIndex?:
number,
index?:
number)
=
>
void) | 点击
左边或者右边文本按钮进行步骤切换时触发该事件
。
<br/>
-
prevIndex:切换前的步骤页索引值。
<br/>
-
index:切换后的步骤页(前一页或者下一页)索引值。 |
| onNext(callback:
(index?:
number,
pendingIndex?:
number)
=
>
void) | 点击
切换下一步骤时触发该事件
。
<br/>
-
index:当前步骤页索引值。
<br/>
-
pendingIndex:下一步骤页索引值。 |
| onPrevious(callback:
(index?:
number,
pendingIndex?:
number)
=
>
void) | 点击
切换上一步骤时触发该事件
。
<br/>
-
index:当前步骤页索引值。
<br/>
-
pendingIndex:上一步骤页索引值。 |
| onChange(callback:
(prevIndex?:
number,
index?:
number)
=
>
void) | 点击
当前StepperItem的prevLabel或nextLabel进行步骤切换时触发该回调
。
<br/>
-
prevIndex:切换前的步骤页索引值。
<br/>
-
index:切换后的步骤页(前一页或者下一页)索引值。 |
| onNext(callback:
(index?:
number,
pendingIndex?:
number)
=
>
void) | 点击
StepperItem的nextLabel切换下一步骤时触发该回调
。
<br/>
-
index:当前步骤页索引值。
<br/>
-
pendingIndex:下一步骤页索引值。 |
| onPrevious(callback:
(index?:
number,
pendingIndex?:
number)
=
>
void) | 点击
StepperItem的prevLabel切换上一步骤时触发该回调
。
<br/>
-
index:当前步骤页索引值。
<br/>
-
pendingIndex:上一步骤页索引值。 |
## 示例
...
...
@@ -50,76 +48,86 @@ Stepper(value?: { index?: number })
@
Entry
@
Component
struct
StepperExample
{
@
State
currentIndex
:
number
=
0
@
State
firstState
:
ItemState
=
ItemState
.
Normal
@
State
secondState
:
ItemState
=
ItemState
.
Normal
@
State
currentIndex
:
number
=
0
;
@
State
firstState
:
ItemState
=
ItemState
.
Normal
;
@
State
secondState
:
ItemState
=
ItemState
.
Normal
;
@
State
thirdState
:
ItemState
=
ItemState
.
Normal
;
build
()
{
Stepper
({
index
:
this
.
currentIndex
})
{
// 第一个步骤页
StepperItem
()
{
Column
()
{
Text
(
'
Page One
'
)
.
fontSize
(
35
)
.
fontColor
(
Color
.
Blue
)
.
width
(
200
)
.
lineHeight
(
50
)
.
margin
({
top
:
250
})
.
margin
({
top
:
250
,
bottom
:
50
})
Button
(
'
change status:
'
+
this
.
firstState
)
.
onClick
(()
=>
{
this
.
firstState
=
this
.
firstState
===
ItemState
.
Skip
?
ItemState
.
Normal
:
ItemState
.
Skip
})
}.
width
(
'
100%
'
)
}
.
nextLabel
(
''
)
.
position
({
x
:
'
35%
'
,
y
:
0
}
)
.
nextLabel
(
'
Next
'
)
.
status
(
this
.
firstState
)
// 第二个步骤页
StepperItem
()
{
Column
()
{
Text
(
'
Page Two
'
)
.
fontSize
(
35
)
.
fontColor
(
Color
.
Blue
)
.
width
(
200
)
.
lineHeight
(
50
)
.
margin
({
top
:
250
})
.
margin
({
top
:
250
,
bottom
:
50
})
Button
(
'
change status:
'
+
this
.
secondState
)
.
onClick
(()
=>
{
this
.
firstState
=
this
.
firstState
===
ItemState
.
Skip
?
ItemState
.
Normal
:
ItemState
.
Skip
this
.
secondState
=
this
.
secondState
===
ItemState
.
Disabled
?
ItemState
.
Normal
:
ItemState
.
Disabled
})
}.
width
(
'
100%
'
)
}
.
nextLabel
(
'
Next
'
)
.
prevLabel
(
'
Previous
'
)
.
status
(
this
.
firstState
)
.
position
({
x
:
'
35%
'
,
y
:
0
})
.
status
(
this
.
secondState
)
// 第三个步骤页
StepperItem
()
{
Column
()
{
Text
(
'
Page Three
'
)
.
fontSize
(
35
)
.
fontColor
(
Color
.
Blue
)
.
width
(
200
)
.
lineHeight
(
50
)
.
margin
({
top
:
250
})
.
margin
({
top
:
250
,
bottom
:
50
})
Button
(
'
change status:
'
+
this
.
thirdState
)
.
onClick
(()
=>
{
this
.
secondState
=
this
.
secon
dState
===
ItemState
.
Waiting
?
ItemState
.
Normal
:
ItemState
.
Waiting
this
.
thirdState
=
this
.
thir
dState
===
ItemState
.
Waiting
?
ItemState
.
Normal
:
ItemState
.
Waiting
})
}.
width
(
'
100%
'
)
}
.
position
({
x
:
'
35%
'
,
y
:
0
})
.
status
(
this
.
secondState
)
.
status
(
this
.
thirdState
)
// 第四个步骤页
StepperItem
()
{
Text
(
'
Page four
'
)
.
fontSize
(
35
)
.
fontColor
(
Color
.
Blue
)
.
width
(
200
)
.
width
(
'
100%
'
)
.
textAlign
(
TextAlign
.
Center
)
.
lineHeight
(
50
)
.
margin
({
top
:
250
})
}
.
position
({
x
:
'
35%
'
,
y
:
0
})
.
nextLabel
(
'
Finish
'
)
}
.
onFinish
(()
=>
{
console
.
log
(
'
onFinish
'
)
// 此处可处理点击最后一页的Finish时的逻辑,例如路由跳转等
console
.
info
(
'
onFinish
'
);
})
.
onSkip
(()
=>
{
console
.
log
(
'
onSkip
'
)
// 此处可处理点击跳过时的逻辑,例如动态修改Stepper的index值使其跳转到某一步骤页等
console
.
info
(
'
onSkip
'
);
})
.
onChange
((
prevIndex
:
number
,
index
:
number
)
=>
{
this
.
currentIndex
=
index
this
.
currentIndex
=
index
;
})
.
align
(
Alignment
.
Center
)
}
}
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录