From bcb1ebcb8302fa8264e12e2261d8fe83f22f046f Mon Sep 17 00:00:00 2001 From: luoying_ace_admin Date: Fri, 20 Jan 2023 14:58:58 +0800 Subject: [PATCH] revise docs Signed-off-by: luoying_ace_admin --- .../reference/apis/js-apis-animator.md | 2 +- .../reference/apis/js-apis-promptAction.md | 10 +- .../reference/apis/js-apis-router.md | 103 ++++-------------- .../reference/apis/js-apis-system-app.md | 28 +++-- .../apis/js-apis-system-mediaquery.md | 4 +- .../reference/apis/js-apis-system-prompt.md | 10 +- .../reference/apis/js-apis-system-router.md | 14 +-- 7 files changed, 62 insertions(+), 109 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-animator.md b/zh-cn/application-dev/reference/apis/js-apis-animator.md index 3a041da806..fd4c0fff21 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-animator.md +++ b/zh-cn/application-dev/reference/apis/js-apis-animator.md @@ -72,7 +72,7 @@ reset(options: AnimatorOptions): void | 错误码ID | 错误信息 | | --------- | ------- | -| 100001 | If no page is found for pageId or fail to get object property list. | +| 100001 | if no page is found for pageId or fail to get object property list. | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-promptAction.md b/zh-cn/application-dev/reference/apis/js-apis-promptAction.md index 1aabdbfb8d..475a00dded 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-promptAction.md +++ b/zh-cn/application-dev/reference/apis/js-apis-promptAction.md @@ -32,7 +32,7 @@ showToast(options: ShowToastOptions): void | 错误码ID | 错误信息 | | --------- | ------- | -| 100001 | If UI execution context not found. | +| 100001 | if UI execution context not found. | **示例:** @@ -88,7 +88,7 @@ showDialog(options: ShowDialogOptions): Promise<ShowDialogSuccessResponse> | 错误码ID | 错误信息 | | --------- | ------- | -| 100001 | If UI execution context not found. | +| 100001 | if UI execution context not found. | **示例:** @@ -142,7 +142,7 @@ showDialog(options: ShowDialogOptions, callback: AsyncCallback<ShowDialogSucc | 错误码ID | 错误信息 | | --------- | ------- | -| 100001 | If UI execution context not found. | +| 100001 | if UI execution context not found. | **示例:** @@ -218,7 +218,7 @@ showActionMenu(options: ActionMenuOptions, callback: AsyncCallback<ActionMenu | 错误码ID | 错误信息 | | --------- | ------- | -| 100001 | If UI execution context not found. | +| 100001 | if UI execution context not found. | **示例:** @@ -276,7 +276,7 @@ showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse | 错误码ID | 错误信息 | | --------- | ------- | -| 100001 | If UI execution context not found. | +| 100001 | if UI execution context not found. | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-router.md b/zh-cn/application-dev/reference/apis/js-apis-router.md index 8318a21c28..9968042392 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-router.md +++ b/zh-cn/application-dev/reference/apis/js-apis-router.md @@ -40,9 +40,9 @@ pushUrl(options: RouterOptions): Promise<void> | 错误码ID | 错误信息 | | --------- | ------- | -| 100001 | If UI execution context not found. | -| 100002 | If the uri is not exist. | -| 100003 | If the pages are pushed too much. | +| 100001 | if UI execution context not found. | +| 100002 | if the uri is not exist. | +| 100003 | if the pages are pushed too much. | **示例:** @@ -89,9 +89,9 @@ pushUrl(options: RouterOptions, callback: AsyncCallback<void>): void | 错误码ID | 错误信息 | | --------- | ------- | -| 100001 | If UI execution context not found. | -| 100002 | If the uri is not exist. | -| 100003 | If the pages are pushed too much. | +| 100001 | if UI execution context not found. | +| 100002 | if the uri is not exist. | +| 100003 | if the pages are pushed too much. | **示例:** @@ -143,9 +143,9 @@ pushUrl(options: RouterOptions, mode: RouterMode): Promise<void> | 错误码ID | 错误信息 | | --------- | ------- | -| 100001 | If UI execution context not found. | -| 100002 | If the uri is not exist. | -| 100003 | If the pages are pushed too much. | +| 100001 | if UI execution context not found. | +| 100002 | if the uri is not exist. | +| 100003 | if the pages are pushed too much. | **示例:** @@ -193,9 +193,9 @@ pushUrl(options: RouterOptions, mode: RouterMode, callback: AsyncCallback<voi | 错误码ID | 错误信息 | | --------- | ------- | -| 100001 | If UI execution context not found. | -| 100002 | If the uri is not exist. | -| 100003 | If the pages are pushed too much. | +| 100001 | if UI execution context not found. | +| 100002 | if the uri is not exist. | +| 100003 | if the pages are pushed too much. | **示例:** @@ -247,8 +247,8 @@ replaceUrl(options: RouterOptions): Promise<void> | 错误码ID | 错误信息 | | --------- | ------- | -| 100001 | If UI execution context not found, only throw in standard system. | -| 200002 | If the uri is not exist. | +| 100001 | if UI execution context not found, only throw in standard system. | +| 200002 | if the uri is not exist. | **示例:** @@ -292,8 +292,8 @@ replaceUrl(options: RouterOptions, callback: AsyncCallback<void>): void | 错误码ID | 错误信息 | | --------- | ------- | -| 100001 | If UI execution context not found, only throw in standard system. | -| 200002 | If the uri is not exist. | +| 100001 | if UI execution context not found, only throw in standard system. | +| 200002 | if the uri is not exist. | **示例:** @@ -344,8 +344,8 @@ replaceUrl(options: RouterOptions, mode: RouterMode): Promise<void> | 错误码ID | 错误信息 | | --------- | ------- | -| 100001 | If UI execution context not found, only throw in standard system. | -| 200002 | If the uri is not exist. | +| 100001 | if UI execution context not found, only throw in standard system. | +| 200002 | if the uri is not exist. | **示例:** @@ -390,8 +390,8 @@ replaceUrl(options: RouterOptions, mode: RouterMode, callback: AsyncCallback< | 错误码ID | 错误信息 | | --------- | ------- | -| 100001 | If UI execution context not found, only throw in standard system. | -| 200002 | If the uri is not exist. | +| 100001 | if UI execution context not found, only throw in standard system. | +| 200002 | if the uri is not exist. | **示例:** @@ -524,7 +524,7 @@ enableBackPageAlert(options: EnableAlertOptions): void | 错误码ID | 错误信息 | | --------- | ------- | -| 100001 | If UI execution context not found. | +| 100001 | if UI execution context not found. | **示例:** @@ -745,37 +745,6 @@ router.push({ } }); ``` -## router.push(deprecated) - -push(options: RouterOptions, mode: RouterMode): void - -跳转到应用内的指定页面。 - -从API version9开始不再维护,建议使用[pushUrl9+](#routerpushurl9) - -**系统能力:** SystemCapability.ArkUI.ArkUI.Full - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------- | ------------------------------- | ---- | ---------- | -| options | [RouterOptions](#routeroptions) | 是 | 跳转页面描述信息。 | -| mode | [RouterMode](#routermode9) | 是 | 跳转页面使用的模式。 | - - -**示例:** - -```js -router.push({ - url: 'pages/routerpage2/routerpage2', - params: { - data1: 'message', - data2: { - data3: [123, 456, 789] - } - } -},router.RouterMode.Standard); -``` ## router.replace(deprecated) @@ -785,7 +754,7 @@ replace(options: RouterOptions): void 从API version9开始不再维护,建议使用[replaceUrl9+](#routerreplaceurl9) -**系统能力:** SystemCapability.ArkUI.ArkUI.Full +**系统能力:** SystemCapability.ArkUI.ArkUI.Lite **参数:** @@ -802,34 +771,6 @@ router.replace({ data1: 'message' } }); -``` - - ## router.replace(deprecated) - -replace(options: RouterOptions, mode: RouterMode): void - -用应用内的某个页面替换当前页面,并销毁被替换的页面。 - -从API version9开始不再维护,建议使用[replaceUrl9+](#routerreplaceurl9) - -**系统能力:** SystemCapability.ArkUI.ArkUI.Lite - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------- | ------------------------------- | ---- | ---------- | -| options | [RouterOptions](#routeroptions) | 是 | 替换页面描述信息。 | -| mode | [RouterMode](#routermode9) | 是 | 跳转页面使用的模式。 | - -**示例:** - -```js -router.replace({ - url: 'pages/detail/detail', - params: { - data1: 'message' - } -}, router.RouterMode.Standard); ``` ## router.enableAlertBeforeBackPage(deprecated) diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-app.md b/zh-cn/application-dev/reference/apis/js-apis-system-app.md index 616f810a53..105134736b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-app.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-app.md @@ -66,8 +66,6 @@ requestFullWindow(options?: RequestFullWindowOptions): void 请求应用以全窗口运行,FA在某些场景下(如半模态FA)会以非全窗口运行,调用该接口会从非全窗口切换为全窗口运行,如果已经以全窗口运行则该接口调用无效。 -此接口为系统接口,三方应用不支持调用。 - > **说明:** 从API Version 7开始,推荐使用[`@ohos.window`](js-apis-window.md)。 **系统能力:** SystemCapability.ArkUI.ArkUI.Full @@ -100,7 +98,7 @@ setImageCacheCount(value: number): void **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| value | number | 否 | 内存中解码后图片的缓存数量。 | +| value | number | 是 | 内存中解码后图片的缓存数量。 | **示例:** @@ -130,7 +128,7 @@ setImageRawDataCacheSize(value: number): void **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| value | number | 否 | 内存中解码前图片数据的缓存大小,单位为字节。 | +| value | number | 是 | 内存中解码前图片数据的缓存大小,单位为字节。 | **示例:** @@ -161,7 +159,7 @@ setImageFileCacheSize(value: number): void **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| value | number | 否 | 图片文件的缓存大小,单位为字节。 | +| value | number | 是 | 图片文件的缓存大小,单位为字节。 | **示例:** @@ -187,20 +185,34 @@ export default { **系统能力:** 以下各项对应的系统能力有所不同,详见下表。 -| 名称 | 参数类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | -------- | -------- | -------- |-------- | | appID6+ | string | 是 | 表示应用的包名,用于标识应用的唯一性。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full| | appName | string | 是 | 表示应用的名称。
**系统能力:** SystemCapability.ArkUI.ArkUI.Lite| | versionName | string | 是 | 表示应用的版本名称。
**系统能力:** SystemCapability.ArkUI.ArkUI.Lite| | versionCode | number | 是 | 表示应用的版本号。
**系统能力:** SystemCapability.ArkUI.ArkUI.Lite| +## ScreenOnVisible(deprecated) + +screenOnVisible(options?: ScreenOnVisibleOptions) + +定义屏幕唤醒时是否保持应用可见。 + +**说明:** 该接口从API Version 8 开始废弃。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full + +| 名称 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- |-------- | +| options | ScreenOnVisibleOptions | 否 | 当启动保活时,锁屏时将阻止系统返回桌面显示,以保持屏幕唤醒时应用可见。 | + ## ScreenOnVisibleOptions 定义屏幕上可见接口的选项。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full -| 名称 | 参数类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | visible | boolean | 否 | 是否启动保活,默认值false。 | | success | () => void | 否 | 接口调用成功的回调函数。 | @@ -213,7 +225,7 @@ export default { **系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full -| 名称 | 参数类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | duration | number | 是 | 定义动画选项的持续时间,单位为毫秒。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-mediaquery.md b/zh-cn/application-dev/reference/apis/js-apis-system-mediaquery.md index 7ca53ced80..7a17fd7c56 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-mediaquery.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-mediaquery.md @@ -49,7 +49,7 @@ let mMediaQueryList = mediaquery.matchMedia('(max-width: 466)'); **系统能力:** SystemCapability.ArkUI.ArkUI.Full -| 名称 | 参数类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | ------- | ------- | ---- | ----- | | matches | boolean | 是 | 匹配结果。 | @@ -61,7 +61,7 @@ let mMediaQueryList = mediaquery.matchMedia('(max-width: 466)'); **系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full -| 名称 | 参数类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | ------- | ------- | ---- | ----------------- | | media | string | 否 | 序列化媒体查询条件,该参数为只读。 | | matches | boolean | 是 | 匹配结果。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-prompt.md b/zh-cn/application-dev/reference/apis/js-apis-system-prompt.md index a79170a9ff..6c67bd9fff 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-prompt.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-prompt.md @@ -133,7 +133,7 @@ export default { **系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full -| 名称 | 参数类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | ------------------- | -------------- | ---- | ---------------------------------------- | | message | string | 是 | 显示的文本信息。 | | duration | number | 否 | 默认值1500ms,建议区间:1500ms-10000ms。若小于1500ms则取默认值,最大取值为10000ms。 | @@ -145,7 +145,7 @@ export default { **系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full -| 名称 | 参数类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | ----- | ------ | ---- | ------- | | text | string | 是 | 定义按钮信息。 | | color | string | 是 | 定义按钮颜色。 | @@ -156,7 +156,7 @@ export default { **系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full -| 名称 | 参数类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | ----- | ------ | ---- | ---------- | | index | number | 是 | 定义数据的索引信息。 | @@ -166,7 +166,7 @@ export default { **系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full -| 名称 | 参数类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------- | ---- | ---------------------------------------- | | title | string | 否 | 标题文本。 | | message | string | 否 | 文本内容。 | @@ -181,7 +181,7 @@ export default { **系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full -| 名称 | 参数类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------- | ---- | ---------------------------------------- | | title | string | 否 | 标题文本。 | | buttons | [[Button](#button), [Button](#button)?, [Button](#button)?, [Button](#button)?, [Button](#button)?, [Button](#button)?] | 是 | 对话框中按钮的数组,结构为:{text:'button', color: '\#666666'},支持1-6个按钮。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-router.md b/zh-cn/application-dev/reference/apis/js-apis-system-router.md index 7a3d939902..0f6ed740af 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-router.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-router.md @@ -126,7 +126,7 @@ back(options?: BackRouterOptions): void | 参数名 | 类型 | 必填 | 说明 | | ------- | --------------------------------------- | ---- | ----------------------- | -| options | [BackRouterOptions](#backrouteroptions) | 是 | 详细请参考BackRouterOptions。 | +| options | [BackRouterOptions](#backrouteroptions) | 否 | 详细请参考BackRouterOptions。 | **示例:** @@ -186,7 +186,7 @@ export default { > **说明:** > 示例中的uri字段是页面路由,由配置文件中的pages列表指定。 -## router.getParams +## router.getParams7+ getParams(): ParamsInterface @@ -339,7 +339,7 @@ export default { **系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Lite -| 名称 | 参数类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | ------ | -------- | ---- | ------------------------------------------------------------ | | uri | string | 是 | 目标页面的uri,可以是以下的两种格式:
1. 页面的绝对路径,由config.json文件中的页面列表提供。例如:
- pages/index/index
-pages/detail/detail
2. 特定路径。如果URI为斜杠(/),则显示主页。 | | params | object | 否 | 表示路由跳转时要同时传递到目标页面的数据。跳转到目标页面后,使用router.getParams()获取传递的参数,此外,在类web范式中,参数也可以在页面中直接使用,如this.keyValue(keyValue为跳转时params参数中的key值),如果目标页面中已有该字段,则其值会被传入的字段值覆盖。 | @@ -351,7 +351,7 @@ export default { **系统能力:** 以下各项对应的系统能力有所不同,详见下表。 -| 名称 | 参数类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | ------ | -------- | ---- | ------------------------------------------------------------ | | uri | string | 否 | 返回到指定uri的界面,如果页面栈上没有uri页面,则不响应该情况。如果uri未设置,则返回上一页。
**系统能力:** SystemCapability.ArkUI.ArkUI.Full | | params | object | 否 | 跳转时要同时传递到目标页面的数据。
**系统能力:** SystemCapability.ArkUI.ArkUI.Lite | @@ -362,7 +362,7 @@ export default { **系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full -| 名称 | 参数类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | ----- | ------ | ---- | ---------------------------------- | | index | number | 是 | 表示当前页面在页面栈中的索引。从栈底到栈顶,index从1开始递增。 | | name | string | 是 | 表示当前页面的名称,即对应文件名。 | @@ -374,7 +374,7 @@ export default { **系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full -| 名称 | 参数类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | -------- | ------------------------ | ---- | -------------------------------------------------- | | message | string | 是 | 询问对话框内容。 | | success | (errMsg: string) => void | 否 | 用户选择对话框确认按钮时触发,errMsg表示返回信息。 | @@ -387,7 +387,7 @@ export default { **系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Full -| 名称 | 参数类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | -------- | ------------------------ | ---- | -------------------------------------------------- | | success | (errMsg: string) => void | 否 | 关闭询问对话框能力成功时触发,errMsg表示返回信息。 | | cancel | (errMsg: string) => void | 否 | 关闭询问对话框能力失败时触发,errMsg表示返回信息。 | -- GitLab