diff --git a/en/application-dev/reference/apis/js-apis-animator.md b/en/application-dev/reference/apis/js-apis-animator.md index da7ec7d145779eb5044427fdee758a34f6b33fdc..9ff98751e425eaca0d814a166f08bdb55cb2083a 100644 --- a/en/application-dev/reference/apis/js-apis-animator.md +++ b/en/application-dev/reference/apis/js-apis-animator.md @@ -1,6 +1,6 @@ -# @ohos.animator +# @ohos.animator (Animator) -The **animator** module provides APIs for applying animation effects, including defining animations, starting animations, and playing animations in reverse order. +The **Animator** module provides APIs for applying animation effects, including defining animations, starting animations, and playing animations in reverse order. > **NOTE** > @@ -72,7 +72,7 @@ For details about the error codes, see [Animator Error Codes](../errorcodes/erro | ID | Error Message| | --------- | ------- | -| 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. | **Example** @@ -283,7 +283,7 @@ export default { easing: 'friction', delay: 0, fill: 'forwards', - direction: 'normal', + direction: "normal", iterations: 2, begin: 200.0, end: 400.0 @@ -296,10 +296,10 @@ export default { easing: 'friction', delay: 0, fill: 'forwards', - direction: "normal", + direction: 'normal', iterations: 2, begin: 0, - end: 400.0, + end: 400.0 }; try { this.animator.reset(options1); @@ -519,7 +519,7 @@ let options = { direction: 'normal', iterations: 3, begin: 200.0, - end: 400.0, + end: 400.0 }; this.animator = animator.createAnimator(options); ``` diff --git a/en/application-dev/reference/apis/js-apis-promptAction.md b/en/application-dev/reference/apis/js-apis-promptAction.md index 0faa9cf211bbd0a673287c34b8d9ad45d34374e6..cfff9e3b3d9b719ae1e00348f72ba603ef218398 100644 --- a/en/application-dev/reference/apis/js-apis-promptAction.md +++ b/en/application-dev/reference/apis/js-apis-promptAction.md @@ -1,4 +1,4 @@ -# @ohos.promptAction +# @ohos.promptAction (Prompt) The **PromptAction** module provides APIs for creating and showing toasts, dialog boxes, and action menus. @@ -32,7 +32,7 @@ For details about the error codes, see [promptAction Error Codes](../errorcodes/ | ID | Error Message| | --------- | ------- | -| 100001 | If UI execution context not found. | +| 100001 | if UI execution context not found. | **Example** @@ -88,7 +88,7 @@ For details about the error codes, see [promptAction Error Codes](../errorcodes/ | ID | Error Message| | --------- | ------- | -| 100001 | If UI execution context not found. | +| 100001 | if UI execution context not found. | **Example** @@ -142,7 +142,7 @@ For details about the error codes, see [promptAction Error Codes](../errorcodes/ | ID | Error Message| | --------- | ------- | -| 100001 | If UI execution context not found. | +| 100001 | if UI execution context not found. | **Example** @@ -218,7 +218,7 @@ For details about the error codes, see [promptAction Error Codes](../errorcodes/ | ID | Error Message| | --------- | ------- | -| 100001 | If UI execution context not found. | +| 100001 | if UI execution context not found. | **Example** @@ -276,7 +276,7 @@ For details about the error codes, see [promptAction Error Codes](../errorcodes/ | ID | Error Message| | --------- | ------- | -| 100001 | If UI execution context not found. | +| 100001 | if UI execution context not found. | **Example** diff --git a/en/application-dev/reference/apis/js-apis-router.md b/en/application-dev/reference/apis/js-apis-router.md index 11bb575b307023f70b92935d98f94cab013998ad..c7bdca6daf4aa32755e6602fd17b9de7d6a62fd6 100644 --- a/en/application-dev/reference/apis/js-apis-router.md +++ b/en/application-dev/reference/apis/js-apis-router.md @@ -1,4 +1,4 @@ -# @ohos.router +# @ohos.router (Page Routing) The **Router** module provides APIs to access pages through URLs. You can use the APIs to navigate to a specified page in an application, replace the current page with another one in an application, and return to the previous page or a specified page. @@ -40,32 +40,28 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc | ID | Error Message| | --------- | ------- | -| 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. | **Example** ```js -try { - router.pushUrl({ - url: 'pages/routerpage2', - params: { - data1: 'message', - data2: { - data3: [123, 456, 789] - } +router.pushUrl({ + url: 'pages/routerpage2', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] } + } +}) + .then(() => { + // success + }) + .catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); }) - .then(() => { - // success - }) - .catch(err => { - console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); - }) -} catch (error) { - console.error(`pushUrl args error code is ${error.code}, message is ${error.message}`); -}; ``` ## router.pushUrl9+ @@ -81,7 +77,7 @@ Navigates to a specified page in the application. | Name | Type | Mandatory | Description | | ------- | ------------------------------- | ---- | --------- | | options | [RouterOptions](#routeroptions) | Yes | Page routing parameters.| -| callback | AsyncCallback<void> | Yes | Callback used to return the result. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result. | **Error codes** @@ -89,32 +85,28 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc | ID | Error Message| | --------- | ------- | -| 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. | **Example** ```js -try { - router.pushUrl({ - url: 'pages/routerpage2', - params: { - data1: 'message', - data2: { - data3: [123, 456, 789] - } - } - }, (err) => { - if (err) { - console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); - return; +router.pushUrl({ + url: 'pages/routerpage2', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] } - console.info('pushUrl success'); - }); -} catch (error) { - console.error(`pushUrl args error code is ${error.code}, message is ${error.message}`); -}; + } +}, (err) => { + if (err) { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('pushUrl success'); +}); ``` ## router.pushUrl9+ @@ -143,32 +135,28 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc | ID | Error Message| | --------- | ------- | -| 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. | **Example** ```js -try { - router.pushUrl({ - url: 'pages/routerpage2', - params: { - data1: 'message', - data2: { - data3: [123, 456, 789] - } +router.pushUrl({ + url: 'pages/routerpage2', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] } - }, router.RouterMode.Standard) - .then(() => { - // success - }) - .catch(err => { - console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); - }) -} catch (error) { - console.error(`pushUrl args error code is ${error.code}, message is ${error.message}`); -}; + } +}, router.RouterMode.Standard) + .then(() => { + // success + }) + .catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) ``` ## router.pushUrl9+ @@ -185,7 +173,7 @@ Navigates to a specified page in the application. | ------- | ------------------------------- | ---- | ---------- | | options | [RouterOptions](#routeroptions) | Yes | Page routing parameters. | | mode | [RouterMode](#routermode9) | Yes | Routing mode.| -| callback | AsyncCallback<void> | Yes | Callback used to return the result. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result. | **Error codes** @@ -193,32 +181,28 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc | ID | Error Message| | --------- | ------- | -| 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. | **Example** ```js -try { - router.pushUrl({ - url: 'pages/routerpage2', - params: { - data1: 'message', - data2: { - data3: [123, 456, 789] - } - } - }, router.RouterMode.Standard, (err) => { - if (err) { - console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); - return; +router.pushUrl({ + url: 'pages/routerpage2', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] } - console.info('pushUrl success'); - }); -} catch (error) { - console.error(`pushUrl args error code is ${error.code}, message is ${error.message}`); -}; + } +}, router.RouterMode.Standard, (err) => { + if (err) { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('pushUrl success'); +}); ``` ## router.replaceUrl9+ @@ -247,28 +231,24 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc | ID | Error Message| | --------- | ------- | -| 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. | **Example** ```js -try { - router.replaceUrl({ - url: 'pages/detail', - params: { - data1: 'message' - } +router.replaceUrl({ + url: 'pages/detail', + params: { + data1: 'message' + } +}) + .then(() => { + // success + }) + .catch(err => { + console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`); }) - .then(() => { - // success - }) - .catch(err => { - console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`); - }) -} catch (error) { - console.error(`replaceUrl args error code is ${error.code}, message is ${error.message}`); -}; ``` ## router.replaceUrl9+ @@ -284,7 +264,7 @@ Replaces the current page with another one in the application and destroys the c | Name | Type | Mandatory| Description | | ------- | ------------------------------- | ---- | ------------------ | | options | [RouterOptions](#routeroptions) | Yes | Description of the new page.| -| callback | AsyncCallback<void> | Yes | Callback used to return the result. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result. | **Error codes** @@ -292,28 +272,24 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc | ID | Error Message| | --------- | ------- | -| 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. | **Example** ```js -try { - router.replaceUrl({ - url: 'pages/detail', - params: { - data1: 'message' - } - }, (err) => { - if (err) { - console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`); - return; - } - console.info('replaceUrl success'); - }); -} catch (error) { - console.error(`replaceUrl args error code is ${error.code}, message is ${error.message}`); -}; +router.replaceUrl({ + url: 'pages/detail', + params: { + data1: 'message' + } +}, (err) => { + if (err) { + console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('replaceUrl success'); +}); ``` ## router.replaceUrl9+ @@ -344,28 +320,24 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc | ID | Error Message| | --------- | ------- | -| 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. | **Example** ```js -try { - router.replaceUrl({ - url: 'pages/detail', - params: { - data1: 'message' - } - }, router.RouterMode.Standard) - .then(() => { - // success - }) - .catch(err => { - console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`); - }) -} catch (error) { - console.error(`replaceUrl args error code is ${error.code}, message is ${error.message}`); -}; +router.replaceUrl({ + url: 'pages/detail', + params: { + data1: 'message' + } +}, router.RouterMode.Standard) + .then(() => { + // success + }) + .catch(err => { + console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`); + }) ``` ## router.replaceUrl9+ @@ -382,7 +354,7 @@ Replaces the current page with another one in the application and destroys the c | ------- | ------------------------------- | ---- | ---------- | | options | [RouterOptions](#routeroptions) | Yes | Description of the new page. | | mode | [RouterMode](#routermode9) | Yes | Routing mode.| -| callback | AsyncCallback<void> | Yes | Callback used to return the result. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result. | **Error codes** @@ -390,28 +362,24 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc | ID | Error Message| | --------- | ------- | -| 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. | **Example** ```js -try { - router.replaceUrl({ - url: 'pages/detail', - params: { - data1: 'message' - } - }, router.RouterMode.Standard, (err) => { - if (err) { - console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`); - return; - } - console.info('replaceUrl success'); - }); -} catch (error) { - console.error(`replaceUrl args error code is ${error.code}, message is ${error.message}`); -}; +router.replaceUrl({ + url: 'pages/detail', + params: { + data1: 'message' + } +}, router.RouterMode.Standard, (err) => { + if (err) { + console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('replaceUrl success'); +}); ``` ## router.back @@ -524,7 +492,7 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc | ID | Error Message| | --------- | ------- | -| 100001 | If UI execution context not found. | +| 100001 | if UI execution context not found. | **Example** @@ -571,9 +539,9 @@ Obtains the parameters passed from the page that initiates redirection to the cu **Return value** -| Type | Description | -| ------ | ----------------- | -| Object | Parameters passed from the page that initiates redirection to the current page.| +| Type | Description | +| ------ | ---------------------------------- | +| object | Parameters passed from the page that initiates redirection to the current page.| **Example** @@ -594,6 +562,7 @@ Describes the page routing options. > **NOTE** + > > The page routing stack supports a maximum of 32 pages. ## RouterMode9+ @@ -636,13 +605,13 @@ export default { ### TypeScript-based Declarative Development Paradigm ```ts -// Navigate to the target page through router.push with the params parameter carried. +// Navigate to the target page through router.pushUrl with the params parameter carried. import router from '@ohos.router' @Entry @Component struct Index { - async routePage() { + async routePage() { let options = { url: 'pages/second', params: { @@ -745,37 +714,6 @@ router.push({ } }); ``` -## router.push(deprecated) - -push(options: RouterOptions, mode: RouterMode): void - -Navigates to a specified page in the application. - -This API is deprecated since API version 9. You are advised to use [pushUrl9+](#routerpushurl9) instead. - -**System capability**: SystemCapability.ArkUI.ArkUI.Full - -**Parameters** - -| Name | Type | Mandatory | Description | -| ------- | ------------------------------- | ---- | ---------- | -| options | [RouterOptions](#routeroptions) | Yes | Page routing parameters. | -| mode | [RouterMode](#routermode9) | Yes | Routing mode.| - - -**Example** - -```js -router.push({ - url: 'pages/routerpage2/routerpage2', - params: { - data1: 'message', - data2: { - data3: [123, 456, 789] - } - } -},router.RouterMode.Standard); -``` ## router.replace(deprecated) @@ -785,7 +723,7 @@ Replaces the current page with another one in the application and destroys the c This API is deprecated since API version 9. You are advised to use [replaceUrl9+](#routerreplaceurl9) instead. -**System capability**: SystemCapability.ArkUI.ArkUI.Full +**System capability**: SystemCapability.ArkUI.ArkUI.Lite **Parameters** @@ -804,34 +742,6 @@ router.replace({ }); ``` -## router.replace(deprecated) - -replace(options: RouterOptions, mode: RouterMode): void - -Replaces the current page with another one in the application and destroys the current page. - -This API is deprecated since API version 9. You are advised to use [replaceUrl9+](#routerreplaceurl9) instead. - -**System capability**: SystemCapability.ArkUI.ArkUI.Lite - -**Parameters** - -| Name | Type | Mandatory | Description | -| ------- | ------------------------------- | ---- | ---------- | -| options | [RouterOptions](#routeroptions) | Yes | Description of the new page. | -| mode | [RouterMode](#routermode9) | Yes | Routing mode.| - -**Example** - -```js -router.replace({ - url: 'pages/detail/detail', - params: { - data1: 'message' - } -}, router.RouterMode.Standard); -``` - ## router.enableAlertBeforeBackPage(deprecated) enableAlertBeforeBackPage(options: EnableAlertOptions): void diff --git a/en/application-dev/reference/apis/js-apis-system-mediaquery.md b/en/application-dev/reference/apis/js-apis-system-mediaquery.md index 841cebeb1da0380128d3704650a0aaf9ef095d5f..bc415bc3375ebfd278dd218bdec4ab48f0f51694 100644 --- a/en/application-dev/reference/apis/js-apis-system-mediaquery.md +++ b/en/application-dev/reference/apis/js-apis-system-mediaquery.md @@ -1,4 +1,4 @@ -# Media Query +# @system.mediaquery (Media Query) The **mediaquery** module provides different styles for different media types. @@ -12,7 +12,7 @@ The **mediaquery** module provides different styles for different media types. ## Modules to Import -``` +```ts import mediaquery from '@system.mediaquery'; ``` @@ -39,8 +39,8 @@ Creates a **MediaQueryList** object based on the query condition. **Example** -``` -var mMediaQueryList = mediaquery.matchMedia('(max-width: 466)'); +```ts +let mMediaQueryList = mediaquery.matchMedia('(max-width: 466)'); ``` ## MediaQueryEvent @@ -97,7 +97,7 @@ Adds a listener for this **MediaQueryList** object. The listener must be added b **Example** -``` +```ts function maxWidthMatch(e){ if(e.matches){ // do something @@ -123,7 +123,7 @@ Removes the listener for this **MediaQueryList** object. **Example** -``` +```ts function maxWidthMatch(e){ if(e.matches){ // do something diff --git a/en/application-dev/reference/apis/js-apis-system-prompt.md b/en/application-dev/reference/apis/js-apis-system-prompt.md index e37601dbfa3ec72d13a7722fb4dc56a8b3fe6fef..adab8c23c1c9f1b3f95cf7190a907bb673368006 100644 --- a/en/application-dev/reference/apis/js-apis-system-prompt.md +++ b/en/application-dev/reference/apis/js-apis-system-prompt.md @@ -1,4 +1,6 @@ -# Prompt +# @system.prompt (Prompt) + +The **PromptAction** module provides APIs for creating and showing toasts, dialog boxes, and action menus. > **NOTE** > @@ -73,7 +75,7 @@ export default { }, ], success: function(data) { - console.log('dialog success callback, click button : ' + data.index); + console.log('dialog success callbackŁ¬click button : ' + data.index); }, cancel: function() { console.log('dialog cancel callback'); diff --git a/en/application-dev/reference/apis/js-apis-system-router.md b/en/application-dev/reference/apis/js-apis-system-router.md index 1d47c8883ae8d3cc4be49d19845ce1b3e3d5bb2a..cb6ae5245d9b11ddc267ee326a34a3ab38164f04 100644 --- a/en/application-dev/reference/apis/js-apis-system-router.md +++ b/en/application-dev/reference/apis/js-apis-system-router.md @@ -1,4 +1,4 @@ -# @system.router +# @system.router (Page Routing) The **Router** module provides APIs to access pages through URIs. @@ -127,7 +127,7 @@ Returns to the previous page or a specified page. | Name | Type | Mandatory | Description | | ------- | --------------------------------------- | ---- | ----------------------- | -| options | [BackRouterOptions](#backrouteroptions) | Yes | For details, see **BackRouterOptions**.| +| options | [BackRouterOptions](#backrouteroptions) | No | For details, see **BackRouterOptions**.| **Example** @@ -136,7 +136,7 @@ Returns to the previous page or a specified page. export default { indexPushPage() { router.push({ - uri: 'pages/detail/detail' + uri: 'pages/detail/detail' }); } } @@ -188,7 +188,7 @@ export default { > > In the example, the **uri** field indicates the page route, which is specified by the **pages** list in the **config.json** file. -## router.getParams +## router.getParams7+ getParams(): ParamsInterface @@ -298,7 +298,7 @@ export default { }, cancel: function() { console.log('cancel'); - } + } }); } } @@ -329,7 +329,7 @@ export default { }, cancel: function() { console.log('cancel'); - } + } }); } } @@ -397,6 +397,6 @@ Defines the **DisableAlertBeforeBackPage** parameters. ## ParamsInterface -| Name | Type | Description | -| ------------- | ------ | ------- | -| [key: string] | Object | List of routing parameters.| +| Name | Type| Description | +| ------------- | -------- | -------------- | +| [key: string] | object | List of routing parameters.|