实现带参数反向传值,要在push跳转的页面添加一个回调函数
push方式跳转
getData = (data) => { return new Promise((resolve, reject) => { console.log(data);
this.data.industryTxt= data.name; this.data.industryId = data.id; resolve(); }); }; /** * 页面跳转 */ selectIndustry(tb:any) { this.navCtrl.push(SettingCategoryPage, { tb : tb, callback: this.getData }); }
SettingCategoryPage:(跳转到的页面)
public callback:any; constructor( public navCtrl: NavController, public navParams: NavParams, public httpPost: HttpService ) { this.callback = this.navParams.get('callback'); }
sendData(event: any): void { this.callback(this.data).then(()=>{ this.navCtrl.pop() }); }参考:https://www.jianshu.com/p/147f44e0fe80