页面跳转 发布 / 订阅
1.发布
this.events.publish("isShow",(this.DetailData));
console.log("Publish 'isShow' Successfully");
2.订阅 / 传递参数
this.events.subscribe("isShow", (data) => {
const params = {
name = data.name,
age = data.name,
isAdult = true,
}
this.navCtrl.setRoot('StudentDetailPage', params);
console.log("Subscribe 'isShow' Successfully");
});
3.取消订阅
this.events.unsubscribe("isShow");
console.log("Cancel 'isShow' successfully");
4.使用参数
if (this.navParams.get("isAdult")) {
this.name = this.navParams.get("name");
this.age = this.navParams.get("age");
}