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

update docs against 5488

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 fe691c59
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
## Modules to Import ## Modules to Import
``` ```js
import mediaquery from '@ohos.mediaquery' import mediaquery from '@ohos.mediaquery'
``` ```
...@@ -33,8 +33,8 @@ Sets the media query criteria and returns the corresponding listening handle. ...@@ -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.| | MediaQueryListener | Listening handle to a media event, which is used to register or unregister the listening callback.|
- Example - Example
``` ```js
listener = mediaquery.matchMediaSync('(orientation: landscape)'); // Listen for landscape events. 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 ...@@ -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.| | callback | Callback&lt;MediaQueryResult&gt; | No| Callback to be unregistered. If the default value is used, all callbacks of the handle are unregistered.|
- Example - Example
``` ```js
import mediaquery from '@ohos.mediaquery' 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) { function onPortrait(mediaQueryResult) {
if (mediaQueryResult.matches) { if (mediaQueryResult.matches) {
// do something here // do something here
...@@ -90,8 +90,8 @@ Unregisters a callback with the corresponding query condition by using the handl ...@@ -90,8 +90,8 @@ Unregisters a callback with the corresponding query condition by using the handl
// do something here // do something here
} }
} }
this.listener.on('change', this.onPortrait) // Registration callback. listener.on('change', onPortrait) // Register a callback.
this.listener.off('change', this.onPortrait) // Deregistration callback. listener.off('change', onPortrait) // Unregister a callback.
``` ```
...@@ -108,7 +108,7 @@ Unregisters a callback with the corresponding query condition by using the handl ...@@ -108,7 +108,7 @@ Unregisters a callback with the corresponding query condition by using the handl
### Example ### Example
``` ```js
import mediaquery from '@ohos.mediaquery' import mediaquery from '@ohos.mediaquery'
let portraitFunc = null let portraitFunc = null
......
# Prompt # 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.
> >
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
## Modules to Import ## Modules to Import
``` ```js
import prompt from '@system.prompt'; import prompt from '@system.prompt';
``` ```
...@@ -31,7 +31,7 @@ Shows the toast. ...@@ -31,7 +31,7 @@ Shows the toast.
**Example** **Example**
``` ```js
export default { export default {
showToast() { showToast() {
prompt.showToast({ prompt.showToast({
...@@ -60,7 +60,7 @@ Shows the dialog box. ...@@ -60,7 +60,7 @@ Shows the dialog box.
**Example** **Example**
``` ```js
export default { export default {
showDialog() { showDialog() {
prompt.showDialog({ prompt.showDialog({
...@@ -73,7 +73,7 @@ export default { ...@@ -73,7 +73,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');
...@@ -100,7 +100,7 @@ Shows the action menu. ...@@ -100,7 +100,7 @@ Shows the action menu.
**Example** **Example**
``` ```js
export default { export default {
showActionMenu() { showActionMenu() {
prompt.showActionMenu({ prompt.showActionMenu({
...@@ -115,11 +115,11 @@ export default { ...@@ -115,11 +115,11 @@ export default {
color: '#000000', color: '#000000',
}, },
], ],
success: function(data) { success: function(tapIndex) {
console.log('dialog success callback, click button : ' + data.tapIndex); console.log('dialog success callback£¬click button : ' + tapIndex);
}, },
fail: function(data) { fail: function(errMsg) {
console.log('dialog fail callback' + data.errMsg); console.log('dialog fail callback' + errMsg);
}, },
}); });
} }
......
# Page Routing # 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. > - 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 @@ ...@@ -11,7 +11,7 @@
## Modules to Import ## Modules to Import
``` ```js
import router from '@system.router'; import router from '@system.router';
``` ```
...@@ -31,7 +31,7 @@ Navigates to a specified page in the application. ...@@ -31,7 +31,7 @@ Navigates to a specified page in the application.
**Example** **Example**
``` ```js
// Current page // Current page
export default { export default {
pushPage() { pushPage() {
...@@ -49,7 +49,7 @@ export default { ...@@ -49,7 +49,7 @@ export default {
``` ```
``` ```js
// routerpage2 page // routerpage2 page
export default { export default {
data: { data: {
...@@ -85,7 +85,7 @@ Replaces the current page with another one in the application and destroys the c ...@@ -85,7 +85,7 @@ Replaces the current page with another one in the application and destroys the c
**Example** **Example**
``` ```js
// Current page // Current page
export default { export default {
replacePage() { replacePage() {
...@@ -100,7 +100,7 @@ export default { ...@@ -100,7 +100,7 @@ export default {
``` ```
``` ```js
// detail page // detail page
export default { export default {
data: { data: {
...@@ -128,7 +128,7 @@ Returns to the previous page or a specified page. ...@@ -128,7 +128,7 @@ Returns to the previous page or a specified page.
**Example** **Example**
``` ```js
// index page // index page
export default { export default {
indexPushPage() { indexPushPage() {
...@@ -140,7 +140,7 @@ export default { ...@@ -140,7 +140,7 @@ export default {
``` ```
``` ```js
// detail page // detail page
export default { export default {
detailPushPage() { detailPushPage() {
...@@ -152,7 +152,7 @@ export default { ...@@ -152,7 +152,7 @@ export default {
``` ```
``` ```js
// Navigate from the mall page to the detail page through router.back(). // Navigate from the mall page to the detail page through router.back().
export default { export default {
mallBackPage() { mallBackPage() {
...@@ -162,7 +162,7 @@ export default { ...@@ -162,7 +162,7 @@ export default {
``` ```
``` ```js
// Navigate from the detail page to the index page through router.back(). // Navigate from the detail page to the index page through router.back().
export default { export default {
defaultBack() { defaultBack() {
...@@ -172,7 +172,7 @@ export default { ...@@ -172,7 +172,7 @@ export default {
``` ```
``` ```js
// Return to the detail page through router.back(). // Return to the detail page through router.back().
export default { export default {
backToDetail() { backToDetail() {
...@@ -208,7 +208,7 @@ Clears all historical pages in the stack and retains only the current page at th ...@@ -208,7 +208,7 @@ Clears all historical pages in the stack and retains only the current page at th
**Example** **Example**
``` ```js
export default { export default {
clearPage() { clearPage() {
router.clear(); router.clear();
...@@ -232,7 +232,7 @@ Obtains the number of pages in the current stack. ...@@ -232,7 +232,7 @@ Obtains the number of pages in the current stack.
**Example** **Example**
``` ```js
export default { export default {
getLength() { getLength() {
var size = router.getLength(); var size = router.getLength();
...@@ -257,7 +257,7 @@ Obtains state information about the current page. ...@@ -257,7 +257,7 @@ Obtains state information about the current page.
**Example** **Example**
``` ```js
export default { export default {
getState() { getState() {
var page = router.getState(); var page = router.getState();
...@@ -284,7 +284,7 @@ Enables the display of a confirm dialog box before returning to the previous pag ...@@ -284,7 +284,7 @@ Enables the display of a confirm dialog box before returning to the previous pag
**Example** **Example**
``` ```js
export default { export default {
enableAlertBeforeBackPage() { enableAlertBeforeBackPage() {
router.enableAlertBeforeBackPage({ router.enableAlertBeforeBackPage({
...@@ -292,8 +292,8 @@ export default { ...@@ -292,8 +292,8 @@ export default {
success: function() { success: function() {
console.log('success'); console.log('success');
}, },
fail: function() { cancel: function() {
console.log('fail'); console.log('cancel');
}, },
}); });
} }
...@@ -316,15 +316,15 @@ Disables the display of a confirm dialog box before returning to the previous pa ...@@ -316,15 +316,15 @@ Disables the display of a confirm dialog box before returning to the previous pa
**Example** **Example**
``` ```js
export default { export default {
disableAlertBeforeBackPage() { disableAlertBeforeBackPage() {
router.disableAlertBeforeBackPage({ router.disableAlertBeforeBackPage({
success: function() { success: function() {
console.log('success'); console.log('success');
}, },
fail: function() { cancel: function() {
console.log('fail'); console.log('cancel');
}, },
}); });
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册