Repository: incubator-weex-site Updated Branches: refs/heads/master b2498a0ce -> 5b760b09f
*[doc] update document of the navigator module. Project: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/commit/b4d49cb2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/tree/b4d49cb2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/diff/b4d49cb2 Branch: refs/heads/master Commit: b4d49cb200966e2d3474621995a1657d7ffccb3d Parents: 0e3ca19 Author: boboning <[email protected]> Authored: Thu Feb 1 16:55:00 2018 +0800 Committer: boboning <[email protected]> Committed: Thu Feb 1 16:55:00 2018 +0800 ---------------------------------------------------------------------- source/references/modules/navigator.md | 83 ++++++++++------------------- 1 file changed, 27 insertions(+), 56 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex-site/blob/b4d49cb2/source/references/modules/navigator.md ---------------------------------------------------------------------- diff --git a/source/references/modules/navigator.md b/source/references/modules/navigator.md index 073e93b..6515a88 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 -<template> - <div class="wrapper"> - <text class="button" @click="push">Push</text> - <text class="button" @click="pop">Pop</text> - </div> -</template> - -<script> - var navigator = weex.requireModule('navigator') - var modal = weex.requireModule('modal') - - export default { - methods: { - push (event) { - var bundleUrl = weex.config.bundleUrl; - navigator.push({ - url: bundleUrl, - animated: "true" + var navigator = weex.requireModule('navigator') + var modal = weex.requireModule('modal') + navigator.pop({ animated: "true" }, event => { - modal.toast({ message: 'callback: ' + event }) + modal.toast({ message: 'callback: ' + event }) }) - }, - pop (event) { - navigator.pop({ - animated: "true" - }, event => { - modal.toast({ message: 'callback: ' + event }) - }) - } - } - }; -</script> - -<style scoped> - .wrapper { - flex-direction: column; - justify-content: center; - } - .button { - font-size: 60px; - width: 450px; - text-align: center; - margin-top: 30px; - margin-left: 150px; - padding-top: 20px; - padding-bottom: 20px; - border-width: 2px; - border-style: solid; - color: #666666; - border-color: #DDDDDD; - background-color: #F5F5F5 - } -</style> ``` +## 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
