From b4d49cb200966e2d3474621995a1657d7ffccb3d Mon Sep 17 00:00:00 2001 From: boboning Date: Thu, 1 Feb 2018 16:55:00 +0800 Subject: [PATCH] *[doc] update document of the navigator module. --- source/references/modules/navigator.md | 83 +++++++++----------------- 1 file changed, 27 insertions(+), 56 deletions(-) diff --git a/source/references/modules/navigator.md b/source/references/modules/navigator.md index 073e93bdc..6515a88a5 100644 --- a/source/references/modules/navigator.md +++ b/source/references/modules/navigator.md @@ -16,9 +16,9 @@ And The navigator module mimics the same behaviors in the iOS/Android applicatio ## API ### push(options, callback) -push a weex page onto the navigator stack, you can specify whether apply animation when pushing. And you can also specify a callback function to be executed after the operation is over. +Push a weex page onto the navigator stack, you can specify whether apply animation when pushing. And you can also specify a callback function to be executed after the operation is over. -**parameters** +**Arguments** * options(object): some options. * url(stirng): The URL of the weex page to push. @@ -26,73 +26,44 @@ push a weex page onto the navigator stack, you can specify whether apply animati * callback(object): the callback function to be called after executing this action. +**Example** + +```html + var navigator = weex.requireModule('navigator') + var modal = weex.requireModule('modal') + var bundleUrl = weex.config.bundleUrl; + navigator.push({ + url: bundleUrl, + animated: "true" + }, event => { + modal.toast({ message: 'callback: ' + event }) + }) +``` + ### pop(options, callback) pop a weex page onto the navigator stack, you can specify whether apply animation when popping. And you can also specify a callback function to be executed after the operation is over. -**parameters** +**Arguments** * options(object): some options. * animated(string): true if the weex page is pop through animation; otherwise, false. Default value is true. * callback(object): the callback function after executing this action. - -## Example +**Example** ```html - - - - - ``` +## Notice +Due to the differences in the behavior of the navigation in clients, the above interfaces need to be adapted. You can implement the above interfaces on the client side by seeing the description of the navigation protocol. + +In addtion,you can read [How to extend] (https://github.com/apache/incubator-weex-site/blob/master/source/guide/extend-ios.md) in iOS/Android to learn how to register the implementation the protocol on the client. + [try it](http://dotwe.org/vue/f2daa25e32eec2a294d59a9144660cad) \ No newline at end of file