uniapp 返回上一页,把数据传回上一页
作者:互联网
let data = arr
//方法一:
let pages = getCurrentPages(); //获取所有页面栈实例列表
let nowPage = pages[ pages.length - 1]; //当前页页面实例
let prevPage = pages[ pages.length - 2 ]; //上一页页面实例
if(this.paramsPage == 'carShip'){
prevPage.data.paramsPage = 'carShip'
prevPage.data.carData = data
}else{
prevPage.data.paramsPage = 'orderPrice'
prevPage.data.carData = data
}
uni.navigateBack({ //uni.navigateTo跳转的返回,默认1为返回上一级
delta: 1
});
//取数据的方式:
var that = this;
var pages = getCurrentPages();
var currPage = pages[pages.length - 1]; //当前页面
let res = currPage.data
console.log(res,']]]]]]]]]]')
this.bladeCouponsData = res.bladeCouponsId
this.bladeCouponsId = res.bladeCouponsId.name
//方法二:利用组件传值的方式
uni.$emit("carData", arr)
//取数据的方式
uni.$on("carData",(rel)=>{
this.carData = rel
this.carInfo = this.carData
})
标签:uniapp,res,data,carData,prevPage,let,一页,传回,pages 来源: https://blog.csdn.net/weixin_43764828/article/details/112131979