Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
79b17cd4
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看板
未验证
提交
79b17cd4
编写于
9月 06, 2023
作者:
O
openharmony_ci
提交者:
Gitee
9月 06, 2023
浏览文件
操作
浏览文件
下载
差异文件
!24120 update api js md
Merge pull request !24120 from 李欣楠/cherry-pick-1693988606
上级
01df108d
f26a4d3d
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
239 addition
and
174 deletion
+239
-174
zh-cn/application-dev/reference/apis/js-apis-arkui-componentUtils.md
...cation-dev/reference/apis/js-apis-arkui-componentUtils.md
+6
-5
zh-cn/application-dev/reference/apis/js-apis-mediaquery.md
zh-cn/application-dev/reference/apis/js-apis-mediaquery.md
+5
-4
zh-cn/application-dev/reference/apis/js-apis-plugincomponent.md
...application-dev/reference/apis/js-apis-plugincomponent.md
+27
-16
zh-cn/application-dev/reference/apis/js-apis-prompt.md
zh-cn/application-dev/reference/apis/js-apis-prompt.md
+14
-9
zh-cn/application-dev/reference/apis/js-apis-promptAction.md
zh-cn/application-dev/reference/apis/js-apis-promptAction.md
+35
-14
zh-cn/application-dev/reference/apis/js-apis-system-prompt.md
...n/application-dev/reference/apis/js-apis-system-prompt.md
+54
-48
zh-cn/application-dev/reference/apis/js-apis-system-router.md
...n/application-dev/reference/apis/js-apis-system-router.md
+98
-78
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-arkui-componentUtils.md
浏览文件 @
79b17cd4
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
## 导入模块
## 导入模块
```
j
s
```
t
s
import
componentUtils
from
'
@ohos.arkui.componentUtils
'
import
componentUtils
from
'
@ohos.arkui.componentUtils
'
```
```
## componentUtils.getRectangleById
## componentUtils.getRectangleById
...
@@ -37,8 +37,9 @@ getRectangleById(id: string): ComponentInfo
...
@@ -37,8 +37,9 @@ getRectangleById(id: string): ComponentInfo
**示例:**
**示例:**
```
js
```
ts
let
modePosition
=
componentUtils
.
getRectangleById
(
"
onClick
"
);
import
componentUtils
from
'
@ohos.arkui.componentUtils
'
;
let
modePosition
:
componentUtils
.
ComponentInfo
=
componentUtils
.
getRectangleById
(
"
onClick
"
);
```
```
## ComponentInfo
## ComponentInfo
...
@@ -140,14 +141,14 @@ let modePosition = componentUtils.getRectangleById("onClick");
...
@@ -140,14 +141,14 @@ let modePosition = componentUtils.getRectangleById("onClick");
**示例:**
**示例:**
```
j
s
```
t
s
import
matrix4
from
'
@ohos.matrix4
'
;
import
matrix4
from
'
@ohos.matrix4
'
;
import
componentUtils
from
'
@ohos.arkui.componentUtils
'
;
import
componentUtils
from
'
@ohos.arkui.componentUtils
'
;
@
Entry
@
Entry
@
Component
@
Component
struct
Utils
{
struct
Utils
{
private
getComponentRect
(
key
)
{
private
getComponentRect
(
key
:
string
)
{
console
.
info
(
"
Mode Key:
"
+
key
);
console
.
info
(
"
Mode Key:
"
+
key
);
let
modePosition
=
componentUtils
.
getRectangleById
(
key
);
let
modePosition
=
componentUtils
.
getRectangleById
(
key
);
...
...
zh-cn/application-dev/reference/apis/js-apis-mediaquery.md
浏览文件 @
79b17cd4
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
## 导入模块
## 导入模块
```
j
s
```
t
s
import
mediaquery
from
'
@ohos.mediaquery
'
import
mediaquery
from
'
@ohos.mediaquery
'
```
```
...
@@ -42,8 +42,9 @@ matchMediaSync(condition: string): MediaQueryListener
...
@@ -42,8 +42,9 @@ matchMediaSync(condition: string): MediaQueryListener
**示例:**
**示例:**
```
js
```
ts
let
listener
=
mediaquery
.
matchMediaSync
(
'
(orientation: landscape)
'
);
//监听横屏事件
import
mediaquery
from
'
@ohos.mediaquery
'
let
listener
:
mediaquery
.
MediaQueryListener
=
mediaquery
.
matchMediaSync
(
'
(orientation: landscape)
'
);
//监听横屏事件
```
```
...
@@ -98,7 +99,7 @@ off(type: 'change', callback?: Callback<MediaQueryResult>): void
...
@@ -98,7 +99,7 @@ off(type: 'change', callback?: Callback<MediaQueryResult>): void
**示例:**
**示例:**
```
j
s
```
t
s
import
mediaquery
from
'
@ohos.mediaquery
'
import
mediaquery
from
'
@ohos.mediaquery
'
let
listener
=
mediaquery
.
matchMediaSync
(
'
(orientation: landscape)
'
);
//监听横屏事件
let
listener
=
mediaquery
.
matchMediaSync
(
'
(orientation: landscape)
'
);
//监听横屏事件
...
...
zh-cn/application-dev/reference/apis/js-apis-plugincomponent.md
浏览文件 @
79b17cd4
...
@@ -8,8 +8,9 @@
...
@@ -8,8 +8,9 @@
## 导入模块
## 导入模块
```
j
s
```
t
s
import
pluginComponentManager
from
'
@ohos.pluginComponent
'
import
pluginComponentManager
from
'
@ohos.pluginComponent
'
import
Want
from
'
@ohos.app.ability.Want
'
;
```
```
## PluginComponentTemplate
## PluginComponentTemplate
...
@@ -153,8 +154,10 @@ OnPushEventCallback = (source: Want, template: PluginComponentTemplate, data: KV
...
@@ -153,8 +154,10 @@ OnPushEventCallback = (source: Want, template: PluginComponentTemplate, data: KV
**示例:**
**示例:**
```
js
```
ts
function
onPushListener
(
source
,
template
,
data
,
extraData
)
{
import
pluginComponentManager
from
'
@ohos.pluginComponent
'
import
Want
from
'
@ohos.app.ability.Want
'
;
function
onPushListener
(
source
:
Want
,
template
:
PluginComponentTemplate
,
data
:
pluginComponentManager
.
KVObject
,
extraData
:
pluginComponentManager
.
KVObject
)
{
console
.
log
(
"
onPushListener template.source=
"
+
template
.
source
)
console
.
log
(
"
onPushListener template.source=
"
+
template
.
source
)
console
.
log
(
"
onPushListener source=
"
+
JSON
.
stringify
(
source
))
console
.
log
(
"
onPushListener source=
"
+
JSON
.
stringify
(
source
))
console
.
log
(
"
onPushListener template=
"
+
JSON
.
stringify
(
template
))
console
.
log
(
"
onPushListener template=
"
+
JSON
.
stringify
(
template
))
...
@@ -180,14 +183,16 @@ OnRequestEventCallback = (source: Want, name: string, data: KVObject) => Request
...
@@ -180,14 +183,16 @@ OnRequestEventCallback = (source: Want, name: string, data: KVObject) => Request
**示例:**
**示例:**
```
js
```
ts
function
onRequestListener
(
source
,
name
,
data
)
{
import
pluginComponentManager
from
'
@ohos.pluginComponent
'
import
Want
from
'
@ohos.app.ability.Want
'
;
function
onRequestListener
(
source
:
Want
,
name
:
string
,
data
:
pluginComponentManager
.
KVObject
)
{
console
.
error
(
"
onRequestListener
"
);
console
.
error
(
"
onRequestListener
"
);
console
.
log
(
"
onRequestListener source=
"
+
JSON
.
stringify
(
source
));
console
.
log
(
"
onRequestListener source=
"
+
JSON
.
stringify
(
source
));
console
.
log
(
"
onRequestListener name=
"
+
name
);
console
.
log
(
"
onRequestListener name=
"
+
name
);
console
.
log
(
"
onRequestListener data=
"
+
JSON
.
stringify
(
data
));
console
.
log
(
"
onRequestListener data=
"
+
JSON
.
stringify
(
data
));
let
RtnData
:
Record
<
string
,
string
|
pluginComponentManager
.
KVObject
>
=
{
'
template
'
:
"
ets/pages/plugin.js
"
,
'
data
'
:
data
}
return
{
template
:
"
ets/pages/plugin.js
"
,
data
:
data
}
;
return
RtnData
;
}
}
```
```
...
@@ -207,7 +212,8 @@ push(param: PushParameters , callback: AsyncCallback<void>): void
...
@@ -207,7 +212,8 @@ push(param: PushParameters , callback: AsyncCallback<void>): void
**示例:**
**示例:**
```
js
```
ts
import
pluginComponentManager
from
'
@ohos.pluginComponent
'
pluginComponentManager
.
push
(
pluginComponentManager
.
push
(
{
{
want
:
{
want
:
{
...
@@ -248,7 +254,8 @@ push(param: PushParameterForStage, callback: AsyncCallback<void>): void
...
@@ -248,7 +254,8 @@ push(param: PushParameterForStage, callback: AsyncCallback<void>): void
**示例:**
**示例:**
```
js
```
ts
import
pluginComponentManager
from
'
@ohos.pluginComponent
'
pluginComponentManager
.
push
(
pluginComponentManager
.
push
(
{
{
owner
:
{
owner
:
{
...
@@ -296,7 +303,8 @@ request(param: RequestParameters, callback: AsyncCallback<RequestCallbackPara
...
@@ -296,7 +303,8 @@ request(param: RequestParameters, callback: AsyncCallback<RequestCallbackPara
**示例:**
**示例:**
```
js
```
ts
import
pluginComponentManager
from
'
@ohos.pluginComponent
'
pluginComponentManager
.
request
(
pluginComponentManager
.
request
(
{
{
want
:
{
want
:
{
...
@@ -339,7 +347,8 @@ request(param: RequestParameterForStage, callback: AsyncCallback<RequestCallb
...
@@ -339,7 +347,8 @@ request(param: RequestParameterForStage, callback: AsyncCallback<RequestCallb
**示例:**
**示例:**
```
js
```
ts
import
pluginComponentManager
from
'
@ohos.pluginComponent
'
pluginComponentManager
.
request
(
pluginComponentManager
.
request
(
{
{
owner
:
{
owner
:
{
...
@@ -378,21 +387,23 @@ on(eventType: string, callback: OnPushEventCallback | OnRequestEventCallback ):
...
@@ -378,21 +387,23 @@ on(eventType: string, callback: OnPushEventCallback | OnRequestEventCallback ):
**示例:**
**示例:**
```
js
```
ts
function
onPushListener
(
source
,
template
,
data
,
extraData
)
{
import
pluginComponentManager
from
'
@ohos.pluginComponent
'
import
Want
from
'
@ohos.app.ability.Want
'
;
function
onPushListener
(
source
:
Want
,
template
:
PluginComponentTemplate
,
data
:
pluginComponentManager
.
KVObject
,
extraData
:
pluginComponentManager
.
KVObject
)
{
console
.
log
(
"
onPushListener template.source=
"
+
template
.
source
)
console
.
log
(
"
onPushListener template.source=
"
+
template
.
source
)
console
.
log
(
"
onPushListener source=
"
+
JSON
.
stringify
(
source
))
console
.
log
(
"
onPushListener source=
"
+
JSON
.
stringify
(
source
))
console
.
log
(
"
onPushListener template=
"
+
JSON
.
stringify
(
template
))
console
.
log
(
"
onPushListener template=
"
+
JSON
.
stringify
(
template
))
console
.
log
(
"
onPushListener data=
"
+
JSON
.
stringify
(
data
))
console
.
log
(
"
onPushListener data=
"
+
JSON
.
stringify
(
data
))
console
.
log
(
"
onPushListener extraData=
"
+
JSON
.
stringify
(
extraData
))
console
.
log
(
"
onPushListener extraData=
"
+
JSON
.
stringify
(
extraData
))
}
}
function
onRequestListener
(
source
,
name
,
data
)
{
function
onRequestListener
(
source
:
Want
,
name
:
string
,
data
:
pluginComponentManager
.
KVObject
)
{
console
.
error
(
"
onRequestListener
"
);
console
.
error
(
"
onRequestListener
"
);
console
.
log
(
"
onRequestListener source=
"
+
JSON
.
stringify
(
source
));
console
.
log
(
"
onRequestListener source=
"
+
JSON
.
stringify
(
source
));
console
.
log
(
"
onRequestListener name=
"
+
name
);
console
.
log
(
"
onRequestListener name=
"
+
name
);
console
.
log
(
"
onRequestListener data=
"
+
JSON
.
stringify
(
data
));
console
.
log
(
"
onRequestListener data=
"
+
JSON
.
stringify
(
data
));
let
RtnData
:
Record
<
string
,
string
|
pluginComponentManager
.
KVObject
>
=
{
'
template
'
:
"
ets/pages/plugin.js
"
,
'
data
'
:
data
}
return
{
template
:
"
ets/pages/plugin.js
"
,
data
:
data
}
;
return
RtnData
;
}
}
pluginComponentManager
.
on
(
"
push
"
,
onPushListener
)
pluginComponentManager
.
on
(
"
push
"
,
onPushListener
)
pluginComponentManager
.
on
(
"
request
"
,
onRequestListener
)
pluginComponentManager
.
on
(
"
request
"
,
onRequestListener
)
...
...
zh-cn/application-dev/reference/apis/js-apis-prompt.md
浏览文件 @
79b17cd4
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
## 导入模块
## 导入模块
```
j
s
```
t
s
import
prompt
from
'
@ohos.prompt
'
import
prompt
from
'
@ohos.prompt
'
```
```
...
@@ -29,8 +29,9 @@ showToast(options: ShowToastOptions): void
...
@@ -29,8 +29,9 @@ showToast(options: ShowToastOptions): void
**示例:**
**示例:**
```
js
```
ts
prompt
.
showToast
({
import
prompt
from
'
@ohos.prompt
'
prompt
.
showToast
({
message
:
'
Message Info
'
,
message
:
'
Message Info
'
,
duration
:
2000
duration
:
2000
});
});
...
@@ -72,7 +73,8 @@ showDialog(options: ShowDialogOptions): Promise<ShowDialogSuccessResponse>
...
@@ -72,7 +73,8 @@ showDialog(options: ShowDialogOptions): Promise<ShowDialogSuccessResponse>
**示例:**
**示例:**
```
js
```
ts
import
prompt
from
'
@ohos.prompt
'
prompt
.
showDialog
({
prompt
.
showDialog
({
title
:
'
Title Info
'
,
title
:
'
Title Info
'
,
message
:
'
Message Info
'
,
message
:
'
Message Info
'
,
...
@@ -90,7 +92,7 @@ prompt.showDialog({
...
@@ -90,7 +92,7 @@ prompt.showDialog({
.
then
(
data
=>
{
.
then
(
data
=>
{
console
.
info
(
'
showDialog success, click button:
'
+
data
.
index
);
console
.
info
(
'
showDialog success, click button:
'
+
data
.
index
);
})
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
Error
)
=>
{
console
.
info
(
'
showDialog error:
'
+
err
);
console
.
info
(
'
showDialog error:
'
+
err
);
})
})
```
```
...
@@ -114,7 +116,8 @@ showDialog(options: ShowDialogOptions, callback: AsyncCallback<ShowDialogSucc
...
@@ -114,7 +116,8 @@ showDialog(options: ShowDialogOptions, callback: AsyncCallback<ShowDialogSucc
**示例:**
**示例:**
```
js
```
ts
import
prompt
from
'
@ohos.prompt
'
prompt
.
showDialog
({
prompt
.
showDialog
({
title
:
'
showDialog Title Info
'
,
title
:
'
showDialog Title Info
'
,
message
:
'
Message Info
'
,
message
:
'
Message Info
'
,
...
@@ -179,7 +182,8 @@ showActionMenu(options: ActionMenuOptions, callback: AsyncCallback<ActionMenu
...
@@ -179,7 +182,8 @@ showActionMenu(options: ActionMenuOptions, callback: AsyncCallback<ActionMenu
**示例:**
**示例:**
```
js
```
ts
import
prompt
from
'
@ohos.prompt
'
prompt
.
showActionMenu
({
prompt
.
showActionMenu
({
title
:
'
Title Info
'
,
title
:
'
Title Info
'
,
buttons
:
[
buttons
:
[
...
@@ -225,7 +229,8 @@ showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse
...
@@ -225,7 +229,8 @@ showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse
**示例:**
**示例:**
```
js
```
ts
import
prompt
from
'
@ohos.prompt
'
prompt
.
showActionMenu
({
prompt
.
showActionMenu
({
title
:
'
showActionMenu Title Info
'
,
title
:
'
showActionMenu Title Info
'
,
buttons
:
[
buttons
:
[
...
@@ -242,7 +247,7 @@ prompt.showActionMenu({
...
@@ -242,7 +247,7 @@ prompt.showActionMenu({
.
then
(
data
=>
{
.
then
(
data
=>
{
console
.
info
(
'
showActionMenu success, click button:
'
+
data
.
index
);
console
.
info
(
'
showActionMenu success, click button:
'
+
data
.
index
);
})
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
Error
)
=>
{
console
.
info
(
'
showActionMenu error:
'
+
err
);
console
.
info
(
'
showActionMenu error:
'
+
err
);
})
})
```
```
...
...
zh-cn/application-dev/reference/apis/js-apis-promptAction.md
浏览文件 @
79b17cd4
...
@@ -14,8 +14,9 @@
...
@@ -14,8 +14,9 @@
## 导入模块
## 导入模块
```
js
```
ts
import
promptAction
from
'
@ohos.promptAction
'
import
promptAction
from
'
@ohos.promptAction
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
```
```
## promptAction.showToast
## promptAction.showToast
...
@@ -42,14 +43,18 @@ showToast(options: ShowToastOptions): void
...
@@ -42,14 +43,18 @@ showToast(options: ShowToastOptions): void
**示例:**
**示例:**
```
js
```
ts
import
promptAction
from
'
@ohos.promptAction
'
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
try
{
promptAction
.
showToast
({
promptAction
.
showToast
({
message
:
'
Message Info
'
,
message
:
'
Message Info
'
,
duration
:
2000
duration
:
2000
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
`showToast args error code is
${
error
.
code
}
, message is
${
error
.
message
}
`
);
let
message
=
(
error
as
BusinessError
).
message
let
code
=
(
error
as
BusinessError
).
code
console
.
error
(
`showToast args error code is
${
code
}
, message is
${
message
}
`
);
};
};
```
```
...
@@ -98,7 +103,9 @@ showDialog(options: ShowDialogOptions): Promise<ShowDialogSuccessResponse>
...
@@ -98,7 +103,9 @@ showDialog(options: ShowDialogOptions): Promise<ShowDialogSuccessResponse>
**示例:**
**示例:**
```
js
```
ts
import
promptAction
from
'
@ohos.promptAction
'
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
try
{
promptAction
.
showDialog
({
promptAction
.
showDialog
({
title
:
'
Title Info
'
,
title
:
'
Title Info
'
,
...
@@ -117,11 +124,13 @@ try {
...
@@ -117,11 +124,13 @@ try {
.
then
(
data
=>
{
.
then
(
data
=>
{
console
.
info
(
'
showDialog success, click button:
'
+
data
.
index
);
console
.
info
(
'
showDialog success, click button:
'
+
data
.
index
);
})
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
Error
)
=>
{
console
.
info
(
'
showDialog error:
'
+
err
);
console
.
info
(
'
showDialog error:
'
+
err
);
})
})
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
`showDialog args error code is
${
error
.
code
}
, message is
${
error
.
message
}
`
);
let
message
=
(
error
as
BusinessError
).
message
let
code
=
(
error
as
BusinessError
).
code
console
.
error
(
`showDialog args error code is
${
code
}
, message is
${
message
}
`
);
};
};
```
```
...
@@ -152,7 +161,9 @@ showDialog(options: ShowDialogOptions, callback: AsyncCallback<ShowDialogSucc
...
@@ -152,7 +161,9 @@ showDialog(options: ShowDialogOptions, callback: AsyncCallback<ShowDialogSucc
**示例:**
**示例:**
```
js
```
ts
import
promptAction
from
'
@ohos.promptAction
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
try
{
promptAction
.
showDialog
({
promptAction
.
showDialog
({
title
:
'
showDialog Title Info
'
,
title
:
'
showDialog Title Info
'
,
...
@@ -175,7 +186,9 @@ try {
...
@@ -175,7 +186,9 @@ try {
console
.
info
(
'
showDialog success callback, click button:
'
+
data
.
index
);
console
.
info
(
'
showDialog success callback, click button:
'
+
data
.
index
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
`showDialog args error code is
${
error
.
code
}
, message is
${
error
.
message
}
`
);
let
message
=
(
error
as
BusinessError
).
message
let
code
=
(
error
as
BusinessError
).
code
console
.
error
(
`showDialog args error code is
${
code
}
, message is
${
message
}
`
);
};
};
```
```
...
@@ -231,7 +244,9 @@ showActionMenu(options: ActionMenuOptions, callback: AsyncCallback<ActionMenu
...
@@ -231,7 +244,9 @@ showActionMenu(options: ActionMenuOptions, callback: AsyncCallback<ActionMenu
**示例:**
**示例:**
```
js
```
ts
import
promptAction
from
'
@ohos.promptAction
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
try
{
promptAction
.
showActionMenu
({
promptAction
.
showActionMenu
({
title
:
'
Title Info
'
,
title
:
'
Title Info
'
,
...
@@ -253,7 +268,9 @@ try {
...
@@ -253,7 +268,9 @@ try {
console
.
info
(
'
showActionMenu success callback, click button:
'
+
data
.
index
);
console
.
info
(
'
showActionMenu success callback, click button:
'
+
data
.
index
);
})
})
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
`showActionMenu args error code is
${
error
.
code
}
, message is
${
error
.
message
}
`
);
let
message
=
(
error
as
BusinessError
).
message
let
code
=
(
error
as
BusinessError
).
code
console
.
error
(
`showActionMenu args error code is
${
code
}
, message is
${
message
}
`
);
};
};
```
```
...
@@ -289,7 +306,9 @@ showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse
...
@@ -289,7 +306,9 @@ showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse
**示例:**
**示例:**
```
js
```
ts
import
promptAction
from
'
@ohos.promptAction
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
try
{
promptAction
.
showActionMenu
({
promptAction
.
showActionMenu
({
title
:
'
showActionMenu Title Info
'
,
title
:
'
showActionMenu Title Info
'
,
...
@@ -307,11 +326,13 @@ try {
...
@@ -307,11 +326,13 @@ try {
.
then
(
data
=>
{
.
then
(
data
=>
{
console
.
info
(
'
showActionMenu success, click button:
'
+
data
.
index
);
console
.
info
(
'
showActionMenu success, click button:
'
+
data
.
index
);
})
})
.
catch
(
err
=>
{
.
catch
(
(
err
:
Error
)
=>
{
console
.
info
(
'
showActionMenu error:
'
+
err
);
console
.
info
(
'
showActionMenu error:
'
+
err
);
})
})
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
`showActionMenu args error code is
${
error
.
code
}
, message is
${
error
.
message
}
`
);
let
message
=
(
error
as
BusinessError
).
message
let
code
=
(
error
as
BusinessError
).
code
console
.
error
(
`showActionMenu args error code is
${
code
}
, message is
${
message
}
`
);
};
};
```
```
...
...
zh-cn/application-dev/reference/apis/js-apis-system-prompt.md
浏览文件 @
79b17cd4
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
## 导入模块
## 导入模块
```
j
s
```
t
s
import
prompt
from
'
@system.prompt
'
;
import
prompt
from
'
@system.prompt
'
;
```
```
...
@@ -33,15 +33,17 @@ showToast(options: ShowToastOptions): void
...
@@ -33,15 +33,17 @@ showToast(options: ShowToastOptions): void
**示例:**
**示例:**
```
js
```
ts
export
default
{
import
prompt
from
'
@system.prompt
'
;
showToast
()
{
class
A
{
prompt
.
showToast
({
showToast
()
{
message
:
'
Message Info
'
,
prompt
.
showToast
({
message
:
'
Message Info
'
,
duration
:
2000
duration
:
2000
});
});
}
}
}
}
export
default
new
A
()
```
```
...
@@ -62,27 +64,29 @@ showDialog(options: ShowDialogOptions): void
...
@@ -62,27 +64,29 @@ showDialog(options: ShowDialogOptions): void
**示例:**
**示例:**
```
js
```
ts
export
default
{
import
prompt
from
'
@system.prompt
'
;
showDialog
()
{
class
B
{
prompt
.
showDialog
({
showDialog
()
{
title
:
'
Title Info
'
,
prompt
.
showDialog
({
message
:
'
Message Info
'
,
title
:
'
Title Info
'
,
buttons
:
[
message
:
'
Message Info
'
,
{
buttons
:
[
text
:
'
button
'
,
{
color
:
'
#666666
'
text
:
'
button
'
,
},
color
:
'
#666666
'
],
},
success
:
function
(
data
)
{
],
console
.
log
(
'
dialog success callback,click button :
'
+
data
.
index
);
success
:
(
data
)
=>
{
},
console
.
log
(
'
dialog success callback,click button :
'
+
data
.
index
);
cancel
:
function
()
{
},
console
.
log
(
'
dialog cancel callback
'
);
cancel
:
()
=>
{
},
console
.
log
(
'
dialog cancel callback
'
);
});
},
});
}
}
}
}
export
default
new
B
()
```
```
## prompt.showActionMenu<sup>6+</sup>
## prompt.showActionMenu<sup>6+</sup>
...
@@ -102,30 +106,32 @@ showActionMenu(options: ShowActionMenuOptions): void
...
@@ -102,30 +106,32 @@ showActionMenu(options: ShowActionMenuOptions): void
**示例:**
**示例:**
```
js
```
ts
export
default
{
import
prompt
from
'
@system.prompt
'
;
showActionMenu
()
{
class
C
{
prompt
.
showActionMenu
({
showActionMenu
()
{
title
:
'
Title Info
'
,
prompt
.
showActionMenu
({
buttons
:
[
title
:
'
Title Info
'
,
{
buttons
:
[
text
:
'
item1
'
,
{
color
:
'
#666666
'
text
:
'
item1
'
,
},
color
:
'
#666666
'
{
},
text
:
'
item2
'
,
{
color
:
'
#000000
'
text
:
'
item2
'
,
},
color
:
'
#000000
'
],
},
success
:
function
(
tapIndex
)
{
],
console
.
log
(
'
dialog success callback,click button :
'
+
tapIndex
);
success
:
(
tapIndex
)
=>
{
},
console
.
log
(
'
dialog success callback,click button :
'
+
tapIndex
);
fail
:
function
(
errMsg
)
{
},
console
.
log
(
'
dialog fail callback
'
+
errMsg
);
fail
:
(
errMsg
)
=>
{
},
console
.
log
(
'
dialog fail callback
'
+
errMsg
);
});
},
});
}
}
}
}
export
default
new
C
()
```
```
## ShowToastOptions
## ShowToastOptions
...
...
zh-cn/application-dev/reference/apis/js-apis-system-router.md
浏览文件 @
79b17cd4
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
## 导入模块
## 导入模块
```
j
s
```
t
s
import
router
from
'
@system.router
'
;
import
router
from
'
@system.router
'
;
```
```
...
@@ -33,9 +33,10 @@ push(options: RouterOptions): void
...
@@ -33,9 +33,10 @@ push(options: RouterOptions): void
**示例:**
**示例:**
```
j
s
```
t
s
// 在当前页面中
// 在当前页面中
export
default
{
import
router
from
'
@system.router
'
;
class
A
{
pushPage
()
{
pushPage
()
{
router
.
push
({
router
.
push
({
uri
:
'
pages/routerpage2/routerpage2
'
,
uri
:
'
pages/routerpage2/routerpage2
'
,
...
@@ -48,23 +49,21 @@ export default {
...
@@ -48,23 +49,21 @@ export default {
});
});
}
}
}
}
export
default
new
A
()
```
```
```
j
s
```
t
s
// 在routerpage2页面中
// 在routerpage2页面中
export
default
{
class
B
{
data
:
{
data
:
Record
<
string
,
string
>
=
{
'
data1
'
:
'
default
'
}
data1
:
'
default
'
,
data2
:
Record
<
string
,
number
[]
>
=
{
'
data3
'
:
[
1
,
2
,
3
]}
data2
:
{
data3
:
[
1
,
2
,
3
]
}
},
onInit
()
{
onInit
()
{
console
.
info
(
'
showData1:
'
+
this
.
data1
);
console
.
info
(
'
showData1:
'
+
this
.
data
.
data
1
);
console
.
info
(
'
showData3:
'
+
this
.
data2
.
data3
);
console
.
info
(
'
showData3:
'
+
this
.
data2
.
data3
);
}
}
}
}
export
default
new
B
()
```
```
> **说明:**
> **说明:**
...
@@ -87,9 +86,10 @@ replace(options: RouterOptions): void
...
@@ -87,9 +86,10 @@ replace(options: RouterOptions): void
**示例:**
**示例:**
```
j
s
```
t
s
// 在当前页面中
// 在当前页面中
export
default
{
import
router
from
'
@system.router
'
;
class
C
{
replacePage
()
{
replacePage
()
{
router
.
replace
({
router
.
replace
({
uri
:
'
pages/detail/detail
'
,
uri
:
'
pages/detail/detail
'
,
...
@@ -99,19 +99,19 @@ export default {
...
@@ -99,19 +99,19 @@ export default {
});
});
}
}
}
}
export
default
new
C
()
```
```
```
j
s
```
t
s
// 在detail页面中
// 在detail页面中
export
default
{
class
Area
{
data
:
{
data
:
Record
<
string
,
string
>
=
{
'
data1
'
:
'
default
'
}
data1
:
'
default
'
},
onInit
()
{
onInit
()
{
console
.
info
(
'
showData1:
'
+
this
.
data
1
)
console
.
info
(
'
showData1:
'
+
this
.
data
)
}
}
}
}
export
default
new
Area
()
```
```
## router.back
## router.back
...
@@ -130,57 +130,67 @@ back(options?: BackRouterOptions): void
...
@@ -130,57 +130,67 @@ back(options?: BackRouterOptions): void
**示例:**
**示例:**
```
j
s
```
t
s
// index页面
// index页面
export
default
{
import
router
from
'
@system.router
'
;
indexPushPage
()
{
class
D
{
router
.
push
({
indexPushPage
()
{
uri
:
'
pages/detail/detail
'
router
.
push
({
});
uri
:
'
pages/detail/detail
'
});
}
}
}
}
export
default
new
D
()
```
```
```
j
s
```
t
s
// detail页面
// detail页面
export
default
{
import
router
from
'
@system.router
'
;
detailPushPage
()
{
class
E
{
router
.
push
({
detailPushPage
()
{
router
.
push
({
uri
:
'
pages/mall/mall
'
uri
:
'
pages/mall/mall
'
});
});
}
}
}
}
export
default
new
E
()
```
```
```
j
s
```
t
s
// mall页面通过back,将返回detail页面
// mall页面通过back,将返回detail页面
export
default
{
import
router
from
'
@system.router
'
;
mallBackPage
()
{
class
F
{
router
.
back
();
mallBackPage
()
{
router
.
back
();
}
}
}
}
export
default
new
F
()
```
```
```
j
s
```
t
s
// detail页面通过back,将返回index页面
// detail页面通过back,将返回index页面
export
default
{
import
router
from
'
@system.router
'
;
defaultBack
()
{
class
G
{
router
.
back
();
defaultBack
()
{
router
.
back
();
}
}
}
}
export
default
new
G
()
```
```
```
j
s
```
t
s
// 通过back,返回到detail页面
// 通过back,返回到detail页面
export
default
{
import
router
from
'
@system.router
'
;
backToDetail
()
{
class
H
{
router
.
back
({
uri
:
'
pages/detail/detail
'
});
backToDetail
()
{
router
.
back
({
uri
:
'
pages/detail/detail
'
});
}
}
}
}
export
default
new
H
()
```
```
> **说明:**
> **说明:**
...
@@ -210,12 +220,14 @@ clear(): void
...
@@ -210,12 +220,14 @@ clear(): void
**示例:**
**示例:**
```
js
```
ts
export
default
{
import
router
from
'
@system.router
'
;
clearPage
()
{
class
I
{
router
.
clear
();
clearPage
()
{
router
.
clear
();
}
}
}
}
export
default
new
I
()
```
```
## router.getLength
## router.getLength
...
@@ -234,13 +246,15 @@ getLength(): string
...
@@ -234,13 +246,15 @@ getLength(): string
**示例:**
**示例:**
```
js
```
ts
export
default
{
import
router
from
'
@system.router
'
;
getLength
()
{
class
J
{
let
size
=
router
.
getLength
();
getLength
()
{
console
.
log
(
'
pages stack size =
'
+
size
);
let
size
=
router
.
getLength
();
console
.
log
(
'
pages stack size =
'
+
size
);
}
}
}
}
export
default
new
J
()
```
```
## router.getState
## router.getState
...
@@ -259,15 +273,17 @@ getState(): RouterState
...
@@ -259,15 +273,17 @@ getState(): RouterState
**示例:**
**示例:**
```
js
```
ts
export
default
{
import
router
from
'
@system.router
'
;
getState
()
{
class
K
{
getState
()
{
let
page
=
router
.
getState
();
let
page
=
router
.
getState
();
console
.
log
(
'
current index =
'
+
page
.
index
);
console
.
log
(
'
current index =
'
+
page
.
index
);
console
.
log
(
'
current name =
'
+
page
.
name
);
console
.
log
(
'
current name =
'
+
page
.
name
);
console
.
log
(
'
current path =
'
+
page
.
path
);
console
.
log
(
'
current path =
'
+
page
.
path
);
}
}
}
}
export
default
new
K
()
```
```
## router.enableAlertBeforeBackPage<sup>6+</sup>
## router.enableAlertBeforeBackPage<sup>6+</sup>
...
@@ -286,20 +302,22 @@ enableAlertBeforeBackPage(options: EnableAlertBeforeBackPageOptions): void
...
@@ -286,20 +302,22 @@ enableAlertBeforeBackPage(options: EnableAlertBeforeBackPageOptions): void
**示例:**
**示例:**
```
js
```
ts
export
default
{
import
router
from
'
@system.router
'
;
enableAlertBeforeBackPage
()
{
class
L
{
router
.
enableAlertBeforeBackPage
({
enableAlertBeforeBackPage
()
{
message
:
'
Message Info
'
,
router
.
enableAlertBeforeBackPage
({
success
:
function
()
{
message
:
'
Message Info
'
,
console
.
log
(
'
success
'
);
success
:
()
=>
{
},
console
.
log
(
'
success
'
);
cancel
:
function
()
{
},
console
.
log
(
'
cancel
'
);
cancel
:
()
=>
{
}
console
.
log
(
'
cancel
'
);
});
}
});
}
}
}
}
export
default
new
L
()
```
```
## router.disableAlertBeforeBackPage<sup>6+</sup>
## router.disableAlertBeforeBackPage<sup>6+</sup>
...
@@ -318,19 +336,21 @@ disableAlertBeforeBackPage(options?: DisableAlertBeforeBackPageOptions): void
...
@@ -318,19 +336,21 @@ disableAlertBeforeBackPage(options?: DisableAlertBeforeBackPageOptions): void
**示例:**
**示例:**
```
js
```
ts
export
default
{
import
router
from
'
@system.router
'
;
disableAlertBeforeBackPage
()
{
class
Z
{
router
.
disableAlertBeforeBackPage
({
disableAlertBeforeBackPage
()
{
success
:
function
()
{
router
.
disableAlertBeforeBackPage
({
console
.
log
(
'
success
'
);
success
:
()
=>
{
},
console
.
log
(
'
success
'
);
cancel
:
function
()
{
},
console
.
log
(
'
cancel
'
);
cancel
:
()
=>
{
}
console
.
log
(
'
cancel
'
);
});
}
});
}
}
}
}
export
default
new
Z
()
```
```
## RouterOptions
## RouterOptions
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录