uni.navigateBack()返回时传递参数,最简单的办法

阅读 55

2022-07-14

效果图:


uni.navigateBack()返回时传递参数,最简单的办法_其它

image.png

分A 父级界面:

methods: {
// 授权获取用户手机号
getPhoneEvent(userData) {
this.User.decryptPhoneNumber(userData, () => {
this.userInfo = uni.getStorageSync('userInfo');
})
},

//用来接收子页面的参数值
otherFun(object){
if(!!object){
console.log('object=========',object)
}
},

}

分B 子页面:

let obj = {
GDlocation: location,
GDAdd: address,
}
var pages = getCurrentPages();
var prevPage = pages[pages.length - 2]; //上一个页面
prevPage.$vm.otherFun(obj);//重点$vm
uni.navigateBack();

精彩评论(0)

0 0 举报