v0.6.1+
As it's known to all that, we can navigate back and forth in the web browser using the navigation bar. And The navigator module mimics the same behaviors in the iOS/Android application. Without such an ability, We will have to stay in the same page forever, so it is very important. Besides the navigation, the module can let us to specify whether to apply animation or not during the transition.
example
<template> <div class="div"> <text class="text" onclick="onItemClick">click me! {{message}}</text> </div> </template> <script> module.exports ={ data:{ message:"" }, methods:{ onItemClick:function(e){ var navigator = require('@weex-module/navigator'); var params = {'url':'http://weex.alibaba-inc.com/raw/html5/3d2996653c1d129603f9c935b895e998.js','animated':true}; navigator.push(params, function(e) { console.log('i am the callback.') }); } } } </script> <style> .div { flex-direction: row; justify-content: space-between; align-items: center; width: 750; height: 90; padding-left:30; padding-right:30; border-bottom-width: 1; border-style: solid; border-color: #dddddd; } .text{ width: 750; height: 90; } </style>
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
options(object): some options.
callback(object): the callback function to be called after executing this action.
var params = { 'url': 'navigator-demo.js', 'animated' : 'true', } var navigator = require('@weex-module/navigator'); navigator.push(params, function(e) { //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
example
var params = { 'animated' : 'true', } var navigator = require('@weex-module/navigator'); navigator.pop(params, function(e) { //callback });
close a weex page, you can specify a callback function to be executed after the operation is over.
parameters
set color for the navigation bar's background color, you can specify a callback function to be executed after the operation is over.
parameters
set left item for the navigation bar, you can specify a callback function to be executed after the operation is over.
parameters
clear left item for the navigation bar, you can specify a callback function to be executed after the operation is over.
parameters
set the right item for the navigation bar, you can specify a callback function to be executed after the operation is over.
parameters
clear the right item for the navigation bar, you can specify a callback function to be executed after the operation is over. parameters
set the more item for the navigation bar, you can specify a callback function to be executed after the operation is over.
parameters
Actually, the function does nothing.
clear the more item for the navigation bar, you can specify a callback function to be executed after the operation is over.
parameters
Actually, the function does nothing.
set the title for the navigation bar, you can specify a callback function to be executed after the operation is over.
parameters
clear the title for the navigation bar, you can specify a callback function to be executed after the operation is over.
parameters