提交 087161c9 编写于 作者: E ester.zhou

update docs (13922)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 7f19dc2f
# @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** > **NOTE**
> >
...@@ -72,7 +72,7 @@ For details about the error codes, see [Animator Error Codes](../errorcodes/erro ...@@ -72,7 +72,7 @@ For details about the error codes, see [Animator Error Codes](../errorcodes/erro
| ID | Error Message| | 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** **Example**
...@@ -283,7 +283,7 @@ export default { ...@@ -283,7 +283,7 @@ export default {
easing: 'friction', easing: 'friction',
delay: 0, delay: 0,
fill: 'forwards', fill: 'forwards',
direction: 'normal', direction: "normal",
iterations: 2, iterations: 2,
begin: 200.0, begin: 200.0,
end: 400.0 end: 400.0
...@@ -296,10 +296,10 @@ export default { ...@@ -296,10 +296,10 @@ export default {
easing: 'friction', easing: 'friction',
delay: 0, delay: 0,
fill: 'forwards', fill: 'forwards',
direction: "normal", direction: 'normal',
iterations: 2, iterations: 2,
begin: 0, begin: 0,
end: 400.0, end: 400.0
}; };
try { try {
this.animator.reset(options1); this.animator.reset(options1);
...@@ -519,7 +519,7 @@ let options = { ...@@ -519,7 +519,7 @@ let options = {
direction: 'normal', direction: 'normal',
iterations: 3, iterations: 3,
begin: 200.0, begin: 200.0,
end: 400.0, end: 400.0
}; };
this.animator = animator.createAnimator(options); this.animator = animator.createAnimator(options);
``` ```
# @ohos.promptAction # @ohos.promptAction (Prompt)
The **PromptAction** module provides APIs for creating and showing toasts, dialog boxes, and action menus. 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/ ...@@ -32,7 +32,7 @@ For details about the error codes, see [promptAction Error Codes](../errorcodes/
| ID | Error Message| | ID | Error Message|
| --------- | ------- | | --------- | ------- |
| 100001 | If UI execution context not found. | | 100001 | if UI execution context not found. |
**Example** **Example**
...@@ -88,7 +88,7 @@ For details about the error codes, see [promptAction Error Codes](../errorcodes/ ...@@ -88,7 +88,7 @@ For details about the error codes, see [promptAction Error Codes](../errorcodes/
| ID | Error Message| | ID | Error Message|
| --------- | ------- | | --------- | ------- |
| 100001 | If UI execution context not found. | | 100001 | if UI execution context not found. |
**Example** **Example**
...@@ -142,7 +142,7 @@ For details about the error codes, see [promptAction Error Codes](../errorcodes/ ...@@ -142,7 +142,7 @@ For details about the error codes, see [promptAction Error Codes](../errorcodes/
| ID | Error Message| | ID | Error Message|
| --------- | ------- | | --------- | ------- |
| 100001 | If UI execution context not found. | | 100001 | if UI execution context not found. |
**Example** **Example**
...@@ -218,7 +218,7 @@ For details about the error codes, see [promptAction Error Codes](../errorcodes/ ...@@ -218,7 +218,7 @@ For details about the error codes, see [promptAction Error Codes](../errorcodes/
| ID | Error Message| | ID | Error Message|
| --------- | ------- | | --------- | ------- |
| 100001 | If UI execution context not found. | | 100001 | if UI execution context not found. |
**Example** **Example**
...@@ -276,7 +276,7 @@ For details about the error codes, see [promptAction Error Codes](../errorcodes/ ...@@ -276,7 +276,7 @@ For details about the error codes, see [promptAction Error Codes](../errorcodes/
| ID | Error Message| | ID | Error Message|
| --------- | ------- | | --------- | ------- |
| 100001 | If UI execution context not found. | | 100001 | if UI execution context not found. |
**Example** **Example**
......
# @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. 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,15 +40,14 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc ...@@ -40,15 +40,14 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc
| ID | Error Message| | ID | Error Message|
| --------- | ------- | | --------- | ------- |
| 100001 | If UI execution context not found. | | 100001 | if UI execution context not found. |
| 100002 | If the uri is not exist. | | 100002 | if the uri is not exist. |
| 100003 | If the pages are pushed too much. | | 100003 | if the pages are pushed too much. |
**Example** **Example**
```js ```js
try { router.pushUrl({
router.pushUrl({
url: 'pages/routerpage2', url: 'pages/routerpage2',
params: { params: {
data1: 'message', data1: 'message',
...@@ -56,16 +55,13 @@ try { ...@@ -56,16 +55,13 @@ try {
data3: [123, 456, 789] data3: [123, 456, 789]
} }
} }
}) })
.then(() => { .then(() => {
// success // success
}) })
.catch(err => { .catch(err => {
console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); 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.pushUrl<sup>9+</sup> ## router.pushUrl<sup>9+</sup>
...@@ -89,15 +85,14 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc ...@@ -89,15 +85,14 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc
| ID | Error Message| | ID | Error Message|
| --------- | ------- | | --------- | ------- |
| 100001 | If UI execution context not found. | | 100001 | if UI execution context not found. |
| 100002 | If the uri is not exist. | | 100002 | if the uri is not exist. |
| 100003 | If the pages are pushed too much. | | 100003 | if the pages are pushed too much. |
**Example** **Example**
```js ```js
try { router.pushUrl({
router.pushUrl({
url: 'pages/routerpage2', url: 'pages/routerpage2',
params: { params: {
data1: 'message', data1: 'message',
...@@ -105,16 +100,13 @@ try { ...@@ -105,16 +100,13 @@ try {
data3: [123, 456, 789] data3: [123, 456, 789]
} }
} }
}, (err) => { }, (err) => {
if (err) { if (err) {
console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`);
return; return;
} }
console.info('pushUrl success'); console.info('pushUrl success');
}); });
} catch (error) {
console.error(`pushUrl args error code is ${error.code}, message is ${error.message}`);
};
``` ```
## router.pushUrl<sup>9+</sup> ## router.pushUrl<sup>9+</sup>
...@@ -143,15 +135,14 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc ...@@ -143,15 +135,14 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc
| ID | Error Message| | ID | Error Message|
| --------- | ------- | | --------- | ------- |
| 100001 | If UI execution context not found. | | 100001 | if UI execution context not found. |
| 100002 | If the uri is not exist. | | 100002 | if the uri is not exist. |
| 100003 | If the pages are pushed too much. | | 100003 | if the pages are pushed too much. |
**Example** **Example**
```js ```js
try { router.pushUrl({
router.pushUrl({
url: 'pages/routerpage2', url: 'pages/routerpage2',
params: { params: {
data1: 'message', data1: 'message',
...@@ -159,16 +150,13 @@ try { ...@@ -159,16 +150,13 @@ try {
data3: [123, 456, 789] data3: [123, 456, 789]
} }
} }
}, router.RouterMode.Standard) }, router.RouterMode.Standard)
.then(() => { .then(() => {
// success // success
}) })
.catch(err => { .catch(err => {
console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); 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.pushUrl<sup>9+</sup> ## router.pushUrl<sup>9+</sup>
...@@ -193,15 +181,14 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc ...@@ -193,15 +181,14 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc
| ID | Error Message| | ID | Error Message|
| --------- | ------- | | --------- | ------- |
| 100001 | If UI execution context not found. | | 100001 | if UI execution context not found. |
| 100002 | If the uri is not exist. | | 100002 | if the uri is not exist. |
| 100003 | If the pages are pushed too much. | | 100003 | if the pages are pushed too much. |
**Example** **Example**
```js ```js
try { router.pushUrl({
router.pushUrl({
url: 'pages/routerpage2', url: 'pages/routerpage2',
params: { params: {
data1: 'message', data1: 'message',
...@@ -209,16 +196,13 @@ try { ...@@ -209,16 +196,13 @@ try {
data3: [123, 456, 789] data3: [123, 456, 789]
} }
} }
}, router.RouterMode.Standard, (err) => { }, router.RouterMode.Standard, (err) => {
if (err) { if (err) {
console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`);
return; return;
} }
console.info('pushUrl success'); console.info('pushUrl success');
}); });
} catch (error) {
console.error(`pushUrl args error code is ${error.code}, message is ${error.message}`);
};
``` ```
## router.replaceUrl<sup>9+</sup> ## router.replaceUrl<sup>9+</sup>
...@@ -247,28 +231,24 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc ...@@ -247,28 +231,24 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc
| ID | Error Message| | ID | Error Message|
| --------- | ------- | | --------- | ------- |
| 100001 | If UI execution context not found, only throw in standard system. | | 100001 | if UI execution context not found, only throw in standard system. |
| 200002 | If the uri is not exist. | | 200002 | if the uri is not exist. |
**Example** **Example**
```js ```js
try { router.replaceUrl({
router.replaceUrl({
url: 'pages/detail', url: 'pages/detail',
params: { params: {
data1: 'message' data1: 'message'
} }
}) })
.then(() => { .then(() => {
// success // success
}) })
.catch(err => { .catch(err => {
console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`); 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<sup>9+</sup> ## router.replaceUrl<sup>9+</sup>
...@@ -292,28 +272,24 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc ...@@ -292,28 +272,24 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc
| ID | Error Message| | ID | Error Message|
| --------- | ------- | | --------- | ------- |
| 100001 | If UI execution context not found, only throw in standard system. | | 100001 | if UI execution context not found, only throw in standard system. |
| 200002 | If the uri is not exist. | | 200002 | if the uri is not exist. |
**Example** **Example**
```js ```js
try { router.replaceUrl({
router.replaceUrl({
url: 'pages/detail', url: 'pages/detail',
params: { params: {
data1: 'message' data1: 'message'
} }
}, (err) => { }, (err) => {
if (err) { if (err) {
console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`); console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`);
return; return;
} }
console.info('replaceUrl success'); console.info('replaceUrl success');
}); });
} catch (error) {
console.error(`replaceUrl args error code is ${error.code}, message is ${error.message}`);
};
``` ```
## router.replaceUrl<sup>9+</sup> ## router.replaceUrl<sup>9+</sup>
...@@ -344,28 +320,24 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc ...@@ -344,28 +320,24 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc
| ID | Error Message| | ID | Error Message|
| --------- | ------- | | --------- | ------- |
| 100001 | If UI execution context not found, only throw in standard system. | | 100001 | if UI execution context not found, only throw in standard system. |
| 200002 | If the uri is not exist. | | 200002 | if the uri is not exist. |
**Example** **Example**
```js ```js
try { router.replaceUrl({
router.replaceUrl({
url: 'pages/detail', url: 'pages/detail',
params: { params: {
data1: 'message' data1: 'message'
} }
}, router.RouterMode.Standard) }, router.RouterMode.Standard)
.then(() => { .then(() => {
// success // success
}) })
.catch(err => { .catch(err => {
console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`); 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<sup>9+</sup> ## router.replaceUrl<sup>9+</sup>
...@@ -390,28 +362,24 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc ...@@ -390,28 +362,24 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc
| ID | Error Message| | ID | Error Message|
| --------- | ------- | | --------- | ------- |
| 100001 | If UI execution context not found, only throw in standard system. | | 100001 | if UI execution context not found, only throw in standard system. |
| 200002 | If the uri is not exist. | | 200002 | if the uri is not exist. |
**Example** **Example**
```js ```js
try { router.replaceUrl({
router.replaceUrl({
url: 'pages/detail', url: 'pages/detail',
params: { params: {
data1: 'message' data1: 'message'
} }
}, router.RouterMode.Standard, (err) => { }, router.RouterMode.Standard, (err) => {
if (err) { if (err) {
console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`); console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`);
return; return;
} }
console.info('replaceUrl success'); console.info('replaceUrl success');
}); });
} catch (error) {
console.error(`replaceUrl args error code is ${error.code}, message is ${error.message}`);
};
``` ```
## router.back ## router.back
...@@ -524,7 +492,7 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc ...@@ -524,7 +492,7 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc
| ID | Error Message| | ID | Error Message|
| --------- | ------- | | --------- | ------- |
| 100001 | If UI execution context not found. | | 100001 | if UI execution context not found. |
**Example** **Example**
...@@ -572,8 +540,8 @@ Obtains the parameters passed from the page that initiates redirection to the cu ...@@ -572,8 +540,8 @@ Obtains the parameters passed from the page that initiates redirection to the cu
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------ | ----------------- | | ------ | ---------------------------------- |
| Object | Parameters passed from the page that initiates redirection to the current page.| | object | Parameters passed from the page that initiates redirection to the current page.|
**Example** **Example**
...@@ -594,6 +562,7 @@ Describes the page routing options. ...@@ -594,6 +562,7 @@ Describes the page routing options.
> **NOTE** > **NOTE**
>
> The page routing stack supports a maximum of 32 pages. > The page routing stack supports a maximum of 32 pages.
## RouterMode<sup>9+</sup> ## RouterMode<sup>9+</sup>
...@@ -636,7 +605,7 @@ export default { ...@@ -636,7 +605,7 @@ export default {
### TypeScript-based Declarative Development Paradigm ### TypeScript-based Declarative Development Paradigm
```ts ```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' import router from '@ohos.router'
@Entry @Entry
...@@ -745,37 +714,6 @@ router.push({ ...@@ -745,37 +714,6 @@ router.push({
} }
}); });
``` ```
## router.push<sup>(deprecated)</sup>
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 [pushUrl<sup>9+</sup>](#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<sup>(deprecated)</sup> ## router.replace<sup>(deprecated)</sup>
...@@ -785,7 +723,7 @@ Replaces the current page with another one in the application and destroys the c ...@@ -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 [replaceUrl<sup>9+</sup>](#routerreplaceurl9) instead. This API is deprecated since API version 9. You are advised to use [replaceUrl<sup>9+</sup>](#routerreplaceurl9) instead.
**System capability**: SystemCapability.ArkUI.ArkUI.Full **System capability**: SystemCapability.ArkUI.ArkUI.Lite
**Parameters** **Parameters**
...@@ -804,34 +742,6 @@ router.replace({ ...@@ -804,34 +742,6 @@ router.replace({
}); });
``` ```
## router.replace<sup>(deprecated)</sup>
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 [replaceUrl<sup>9+</sup>](#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<sup>(deprecated)</sup> ## router.enableAlertBeforeBackPage<sup>(deprecated)</sup>
enableAlertBeforeBackPage(options: EnableAlertOptions): void enableAlertBeforeBackPage(options: EnableAlertOptions): void
......
# Media Query # @system.mediaquery (Media Query)
The **mediaquery** module provides different styles for different media types. The **mediaquery** module provides different styles for different media types.
...@@ -12,7 +12,7 @@ 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 ## Modules to Import
``` ```ts
import mediaquery from '@system.mediaquery'; import mediaquery from '@system.mediaquery';
``` ```
...@@ -39,8 +39,8 @@ Creates a **MediaQueryList** object based on the query condition. ...@@ -39,8 +39,8 @@ Creates a **MediaQueryList** object based on the query condition.
**Example** **Example**
``` ```ts
var mMediaQueryList = mediaquery.matchMedia('(max-width: 466)'); let mMediaQueryList = mediaquery.matchMedia('(max-width: 466)');
``` ```
## MediaQueryEvent ## MediaQueryEvent
...@@ -97,7 +97,7 @@ Adds a listener for this **MediaQueryList** object. The listener must be added b ...@@ -97,7 +97,7 @@ Adds a listener for this **MediaQueryList** object. The listener must be added b
**Example** **Example**
``` ```ts
function maxWidthMatch(e){ function maxWidthMatch(e){
if(e.matches){ if(e.matches){
// do something // do something
...@@ -123,7 +123,7 @@ Removes the listener for this **MediaQueryList** object. ...@@ -123,7 +123,7 @@ Removes the listener for this **MediaQueryList** object.
**Example** **Example**
``` ```ts
function maxWidthMatch(e){ function maxWidthMatch(e){
if(e.matches){ if(e.matches){
// do something // do something
......
# Prompt # @system.prompt (Prompt)
The **PromptAction** module provides APIs for creating and showing toasts, dialog boxes, and action menus.
> **NOTE** > **NOTE**
> >
...@@ -73,7 +75,7 @@ export default { ...@@ -73,7 +75,7 @@ export default {
}, },
], ],
success: function(data) { success: function(data) {
console.log('dialog success callback, click button : ' + data.index); console.log('dialog success callback£¬click button : ' + data.index);
}, },
cancel: function() { cancel: function() {
console.log('dialog cancel callback'); console.log('dialog cancel callback');
......
# @system.router # @system.router (Page Routing)
The **Router** module provides APIs to access pages through URIs. The **Router** module provides APIs to access pages through URIs.
...@@ -127,7 +127,7 @@ Returns to the previous page or a specified page. ...@@ -127,7 +127,7 @@ Returns to the previous page or a specified page.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------- | --------------------------------------- | ---- | ----------------------- | | ------- | --------------------------------------- | ---- | ----------------------- |
| options | [BackRouterOptions](#backrouteroptions) | Yes | For details, see **BackRouterOptions**.| | options | [BackRouterOptions](#backrouteroptions) | No | For details, see **BackRouterOptions**.|
**Example** **Example**
...@@ -188,7 +188,7 @@ export default { ...@@ -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. > 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.getParams<sup>7+</sup>
getParams(): ParamsInterface getParams(): ParamsInterface
...@@ -397,6 +397,6 @@ Defines the **DisableAlertBeforeBackPage** parameters. ...@@ -397,6 +397,6 @@ Defines the **DisableAlertBeforeBackPage** parameters.
## ParamsInterface ## ParamsInterface
| Name | Type | Description | | Name | Type| Description |
| ------------- | ------ | ------- | | ------------- | -------- | -------------- |
| [key: string] | Object | List of routing parameters.| | [key: string] | object | List of routing parameters.|
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册