提交 549a6129 编写于 作者: W wusongqing

updated against against 5489

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 0729632e
# Media Query
> ![icon-note.gif](public_sys-resources/icon-note.gif)**NOTE**
> **NOTE**
>
> The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```
```js
import mediaquery from '@ohos.mediaquery'
```
......@@ -22,19 +23,19 @@ matchMediaSync(condition: string): MediaQueryListener
Sets the media query criteria and returns the corresponding listening handle.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| condition | string | Yes| Matching condition of a media event.|
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | ------ | ---- | ---------- |
| condition | string | Yes | Matching condition of a media event.|
- Return value
| Type| Description|
| -------- | -------- |
| MediaQueryListener | Listening handle to a media event, which is used to register or unregister the listening callback.|
**Return value**
| Type | Description |
| ------------------ | ---------------------- |
| MediaQueryListener | Listening handle to a media event, which is used to register or unregister the listening callback.|
- Example
```
listener = mediaquery.matchMediaSync('(orientation: landscape)'); // Listen for landscape events.
**Example**
```js
listener = mediaquery.matchMediaSync('(orientation: landscape)'); // Listen for landscape events.
```
......@@ -45,10 +46,10 @@ Media query handle, including the first query result when the handle is applied
### Attributes
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| matches | boolean | Yes| No| Whether the match condition is met.|
| media | string | Yes| No| Matching condition of a media event.|
| Name | Type | Readable | Writable | Description |
| ------- | ------- | ---- | ---- | ---------- |
| matches | boolean | Yes | No | Whether the match condition is met. |
| media | string | Yes | No | Matching condition of a media event.|
### on
......@@ -57,13 +58,13 @@ on(type: 'change', callback: Callback&lt;MediaQueryResult&gt;): void
Registers a callback with the corresponding query condition by using the handle. This callback is triggered when the media attributes change.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Must enter the string **change**.|
| callback | Callback&lt;MediaQueryResult&gt; | Yes| Callback registered with media query.|
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------------------------------- | ---- | ---------------- |
| type | string | Yes | Must enter the string **change**.|
| callback | Callback&lt;MediaQueryResult&gt; | Yes | Callback registered with media query. |
- Example
**Example**
For details, see [off Example](#off).
......@@ -72,14 +73,14 @@ Registers a callback with the corresponding query condition by using the handle.
off(type: 'change', callback?: Callback&lt;MediaQueryResult&gt;): void
Unregisters a callback with the corresponding query condition by using the handle, so that no callback is triggered when the media attributes change.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | boolean | Yes| Must enter the string **change**.|
| callback | Callback&lt;MediaQueryResult&gt; | No| Callback to be unregistered. If the default value is used, all callbacks of the handle are unregistered.|
- Example
```
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------------------------------- | ---- | ----------------------------- |
| type | boolean | Yes | Must enter the string **change**. |
| callback | Callback&lt;MediaQueryResult&gt; | No | Callback to be unregistered. If the default value is used, all callbacks of the handle are unregistered.|
**Example**
```js
import mediaquery from '@ohos.mediaquery'
listener = mediaquery.matchMediaSync('(orientation: landscape)'); // Listen for landscape events.
......@@ -90,8 +91,8 @@ Unregisters a callback with the corresponding query condition by using the handl
// do something here
}
}
this.listener.on('change', this.onPortrait) // Registration callback.
this.listener.off('change', this.onPortrait) // Deregistration callback.
listener.on('change', onPortrait) // Register a callback.
listener.off('change', onPortrait) // Unregister a callback.
```
......@@ -100,15 +101,15 @@ Unregisters a callback with the corresponding query condition by using the handl
### Attributes
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| matches | boolean | Yes| No| Whether the match condition is met.|
| media | string | Yes| No| Matching condition of a media event.|
| Name | Type | Readable | Writable | Description |
| ------- | ------- | ---- | ---- | ---------- |
| matches | boolean | Yes | No | Whether the match condition is met. |
| media | string | Yes | No | Matching condition of a media event.|
### Example
```
```js
import mediaquery from '@ohos.mediaquery'
let portraitFunc = null
......
# Prompt
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**
>
> - The APIs of this module are no longer maintained since API version 8. You are advised to use ['@ohos.prompt](js-apis-prompt.md)' instead.
> - The APIs of this module are no longer maintained since API version 8. You are advised to use [`@ohos.prompt`](js-apis-prompt.md) instead.
>
>
> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -11,7 +11,7 @@
## Modules to Import
```
```js
import prompt from '@system.prompt';
```
......@@ -26,12 +26,12 @@ Shows the toast.
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | ------------------------------------- | --------- | ------------------------------ |
| options | [ShowToastOptions](#showtoastoptions) | Yes | Options for showing the toast. |
| ------- | ------------------------------------- | ---- | --------------- |
| options | [ShowToastOptions](#showtoastoptions) | Yes | Options for showing the toast.|
**Example**
```
```js
export default {
showToast() {
prompt.showToast({
......@@ -54,13 +54,13 @@ Shows the dialog box.
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | --------------------------------------- | --------- | ----------------------------------- |
| options | [ShowDialogOptions](#showdialogoptions) | Yes | Options for showing the dialog box. |
| ------- | --------------------------------------- | ---- | ----------- |
| options | [ShowDialogOptions](#showdialogoptions) | Yes | Options for showing the dialog box.|
**Example**
```
```js
export default {
showDialog() {
prompt.showDialog({
......@@ -94,13 +94,13 @@ Shows the action menu.
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | ---------------------------------------- | --------- | ------------------------------------ |
| options | [ShowActionMenuOptions](#showactionmenuoptions) | Yes | Options for showing the action menu. |
| ------- | ---------------------------------------- | ---- | -------------------- |
| options | [ShowActionMenuOptions](#showactionmenuoptions) | Yes | Options for showing the action menu.|
**Example**
```
```js
export default {
showActionMenu() {
prompt.showActionMenu({
......@@ -115,11 +115,11 @@ export default {
color: '#000000',
},
],
success: function(data) {
success: function(tapIndex) {
console.log('dialog success callback, click button : ' + data.tapIndex);
},
fail: function(data) {
console.log('dialog fail callback' + data.errMsg);
fail: function(errMsg) {
console.log('dialog fail callback' + errMsg);
},
});
}
......@@ -132,10 +132,10 @@ Describes the options for showing the toast.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description |
| ------------------- | -------------- | --------- | ---------------------------------------- |
| ------------------- | -------------- | ---- | ---------------------------------------- |
| message | string | Yes | Text to display. |
| duration | number | No | Duration that the toast will remain on the screen. The default value is 1500 ms. The recommended value range is 1500 ms to 10000 ms. If a value less than 1500 ms is set, the default value is used. |
| bottom<sup>5+</sup> | string\|number | No | Distance between the toast frame and the bottom of the screen. |
| duration | number | No | Duration that the toast will remain on the screen. The default value is 1500 ms. The recommended value range is 1500 ms to 10000 ms. If a value less than 1500 ms is set, the default value is used.|
| bottom<sup>5+</sup> | string\|number | No | Distance between the toast border and the bottom of the screen. |
## Button
......@@ -144,9 +144,9 @@ Defines the prompt information of a button.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description |
| ----- | ------ | --------- | ----------------------------- |
| text | string | Yes | Text displayed on the button. |
| color | string | Yes | Color of the button. |
| ----- | ------ | ---- | ------- |
| text | string | Yes | Text displayed on the button.|
| color | string | Yes | Color of the button.|
## ShowDialogSuccessResponse
......@@ -155,8 +155,8 @@ Defines the dialog box response result.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description |
| ----- | ------ | --------- | ----------- |
| index | number | Yes | Data index. |
| ----- | ------ | ---- | ---------- |
| index | number | Yes | Data index.|
## ShowDialogOptions
......@@ -165,10 +165,10 @@ Describes the options for showing the dialog box.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | --------- | ---------------------------------------- |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| title | string | No | Title of the text to display. |
| message | string | No | Text body. |
| buttons | [[Button](#button), [Button](#button)?, [Button](#button)?] | No | Array of buttons in the dialog box. The array structure is **{text:'button', color: '\#666666'}**. One to six buttons are supported. If there are more than six buttons, extra buttons will not be displayed. |
| buttons | [[Button](#button), [Button](#button)?, [Button](#button)?] | No | Array of buttons in the dialog box. The array structure is **{text:'button', color: '\#666666'}**. One to six buttons are supported. If there are more than six buttons, extra buttons will not be displayed.|
| success | (data: [ShowDialogSuccessResponse](#showdialogsuccessresponse)) => void | No | Callback upon success. |
| cancel | (data: string, code: string) => void | No | Callback upon failure. |
| complete | (data: string) => void | No | Called when the API call is complete. |
......@@ -180,9 +180,9 @@ Describes the options for showing the action menu.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | --------- | ---------------------------------------- |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| title | string | No | Title of the text to display. |
| buttons | [[Button](#button), [Button](#button)?, [Button](#button)?, [Button](#button)?, [Button](#button)?, [Button](#button)?] | Yes | Array of buttons in the dialog box. The array structure is **{text:'button', color: '\#666666'}**. One to six buttons are supported. |
| buttons | [[Button](#button), [Button](#button)?, [Button](#button)?, [Button](#button)?, [Button](#button)?, [Button](#button)?] | Yes | Array of buttons in the dialog box. The array structure is **{text:'button', color: '\#666666'}**. One to six buttons are supported.|
| success | (tapIndex: number, errMsg: string) => void | No | Invoked when a dialog box is displayed. |
| fail | (errMsg: string) => void | No | Callback upon failure. |
| complete | (data: string) => void | No | Invoked when a dialog box is closed. |
# Page Routing
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> **NOTE**
>
> - The APIs of this module are no longer maintained since API version 8. You are advised to use [`@ohos.router`](js-apis-router.md) instead.
>
......@@ -11,7 +11,7 @@
## Modules to Import
```
```js
import router from '@system.router';
```
......@@ -31,7 +31,7 @@ Navigates to a specified page in the application.
**Example**
```
```js
// Current page
export default {
pushPage() {
......@@ -49,7 +49,7 @@ export default {
```
```
```js
// routerpage2 page
export default {
data: {
......@@ -85,7 +85,7 @@ Replaces the current page with another one in the application and destroys the c
**Example**
```
```js
// Current page
export default {
replacePage() {
......@@ -100,7 +100,7 @@ export default {
```
```
```js
// detail page
export default {
data: {
......@@ -128,7 +128,7 @@ Returns to the previous page or a specified page.
**Example**
```
```js
// index page
export default {
indexPushPage() {
......@@ -140,7 +140,7 @@ export default {
```
```
```js
// detail page
export default {
detailPushPage() {
......@@ -152,7 +152,7 @@ export default {
```
```
```js
// Navigate from the mall page to the detail page through router.back().
export default {
mallBackPage() {
......@@ -162,7 +162,7 @@ export default {
```
```
```js
// Navigate from the detail page to the index page through router.back().
export default {
defaultBack() {
......@@ -172,7 +172,7 @@ export default {
```
```
```js
// Return to the detail page through router.back().
export default {
backToDetail() {
......@@ -208,7 +208,7 @@ Clears all historical pages in the stack and retains only the current page at th
**Example**
```
```js
export default {
clearPage() {
router.clear();
......@@ -232,7 +232,7 @@ Obtains the number of pages in the current stack.
**Example**
```
```js
export default {
getLength() {
var size = router.getLength();
......@@ -257,7 +257,7 @@ Obtains state information about the current page.
**Example**
```
```js
export default {
getState() {
var page = router.getState();
......@@ -284,7 +284,7 @@ Enables the display of a confirm dialog box before returning to the previous pag
**Example**
```
```js
export default {
enableAlertBeforeBackPage() {
router.enableAlertBeforeBackPage({
......@@ -292,8 +292,8 @@ export default {
success: function() {
console.log('success');
},
fail: function() {
console.log('fail');
cancel: function() {
console.log('cancel');
},
});
}
......@@ -316,15 +316,15 @@ Disables the display of a confirm dialog box before returning to the previous pa
**Example**
```
```js
export default {
disableAlertBeforeBackPage() {
router.disableAlertBeforeBackPage({
success: function() {
console.log('success');
},
fail: function() {
console.log('fail');
cancel: function() {
console.log('cancel');
},
});
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册