提交 0eb14573 编写于 作者: W wusongqing

update docs against 5488

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 fe691c59
......@@ -6,7 +6,7 @@
## Modules to Import
```
```js
import mediaquery from '@ohos.mediaquery'
```
......@@ -33,8 +33,8 @@ Sets the media query criteria and returns the corresponding listening handle.
| 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.
```js
let listener = mediaquery.matchMediaSync('(orientation: landscape)'); // Listen for landscape events.
```
......@@ -79,10 +79,10 @@ Unregisters a callback with the corresponding query condition by using the handl
| 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.
let listener = mediaquery.matchMediaSync('(orientation: landscape)'); // Listen for landscape events.
function onPortrait(mediaQueryResult) {
if (mediaQueryResult.matches) {
// do something here
......@@ -90,8 +90,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.
```
......@@ -108,7 +108,7 @@ Unregisters a callback with the corresponding query condition by using the handl
### 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.
>
......@@ -11,7 +11,7 @@
## Modules to Import
```
```js
import prompt from '@system.prompt';
```
......@@ -31,7 +31,7 @@ Shows the toast.
**Example**
```
```js
export default {
showToast() {
prompt.showToast({
......@@ -60,7 +60,7 @@ Shows the dialog box.
**Example**
```
```js
export default {
showDialog() {
prompt.showDialog({
......@@ -100,7 +100,7 @@ Shows the action menu.
**Example**
```
```js
export default {
showActionMenu() {
prompt.showActionMenu({
......@@ -115,11 +115,11 @@ export default {
color: '#000000',
},
],
success: function(data) {
console.log('dialog success callback, click button : ' + data.tapIndex);
success: function(tapIndex) {
console.log('dialog success callback£¬click button : ' + tapIndex);
},
fail: function(data) {
console.log('dialog fail callback' + data.errMsg);
fail: function(errMsg) {
console.log('dialog fail callback' + errMsg);
},
});
}
......
# 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.
先完成此消息的编辑!
想要评论请 注册