Navigator 导航

静态方法,无界面和交互

何时使用#

例如 button 点击事件之后,需要 location.href 到相应页面,实现location.href 类似的功能。

  • 设置页面标题,weex容器里显示在容器顶部,h5状态等同于document.title
  • 导航到下个页面,h5 端降级为location.href, weex 容器中采用qap navigator 组件新开一个容器。
  • urlType ,可选weex,url,默认值为weex

代码演示


/** @jsx createElement */
import {createElement, Component} from 'weex-rx';
import { View, Text} from 'nuke-components';
import { Button,Navigator } from 'nuke';
import {mount} from 'nuke-mounter';


let App = class NukeDemoIndex extends Component {
    constructor() {
        super();

    }

    press() {
        Navigator.push('//www.taobao.com');
    }

    render() {
        return (
            <View>
                <View style={{flexDirection:'row',marginBottom:'20rem'}}>
                    <Button onPress={this.press.bind(this)} type="primary">点我走开</Button>
                </View>

            </View>

        );
    }
}

mount(<App/>, mountNode);

普通按钮。

mobile phone header