react页面之间的跳转及传值
2016-08-02 14:01
465 查看
A页面跳转到B页面,A页面发一个信号给路由router,然后由路由进入B页面,并不是由A直接跳转到B页面
A页面中,触发下面的一段代码,跳转到B页面, bb代表B页面的路由标识
this.context.router.push({ pathname: '/bb', query: { id: ID,
name:B,},
});
在B页面constructor方法中,实现接收A页面传值的代码即可。
constructor(props, context) {
super(props, context); this.id = ""+ (props.location.query) ? props.location.query.id : null;
this.name= ""+ (props.location.query) ? props.location.query.name: null;
}
B页面实现下边这个方法才能从其他页面跳转到B页面,这个方法在放在类的外边,放在“export default B”
B.contextTypes = {router:()=> React.PropTypes.func.isRequired };
相关文章推荐
- React Native 页面之间传值、回传数据
- React-native页面跳转传值实现
- 《ReactNative实战讲义》React-native-router-flux框架篇---页面跳转与传值
- React Native 页面之间传值、回传数据
- html 页面之间跳转和传值
- HTML页面之间跳转与传值(JS代码)
- HTML页面之间跳转传值
- HTML页面之间跳转与传值(JS代码)
- android-学会页面之间的跳转与传值
- HTML页面之间跳转与传值(JS代码)
- 【android开发】页面之间的跳转和传值
- reactwebAPP的各个页面之间的跳转以及footer相对应!
- 页面之间传值跳转
- react-native最新的ES6基于页面跳转和传值
- html 页面之间跳转和传值
- Java---页面之间传值跳转
- IOS 页面之间的跳转以及传值
- html 页面之间跳转和传值
- react native 不同页面之间传参 传值 __listview列表跳转详情页 带参数 传值
- 客户端跳转 和 服务器端跳转 页面之间的数据传递