返回刷新
A页面
const navigator = this.props.navigator;
let _this = this;
if(navigator){
navigator.push({
component:PersonInfo,
name:'personInfo',
params:{
userName:userName,
userUrl:userUrl,
userMark:userMark,
userAdress:userAdress,
userID:userID,
callback:()=>this.GeiSessionID() //刷新方法,可以是网络请求
}
})
}
B页面
Back={()=> {
const {navigator}=this.props;
if (navigator) {
//回调刷新上个页面
this.props.callback();
navigator.pop();
}
}}
传值
A页面
let _this = this;
const { navigator } = this.props;
if(navigator) {
navigator.push({
name: 'AddRemark',
component: AddRemark,
params: {
remark: this.state.remark,
userID:this.props.userID,
//回调!从SecondPageComponent获取user
getRemark: function(user) {
_this.setState({
remark: user
})
}
}
});
}
B页面
const { navigator } = this.props;
if(this.state.remark) {
let user = this.state.remark;
//回调传值给上个页面
this.props.getRemark(user);
}
这样就完成了传值 回调 和刷新