在页面跳转的时候,可以通过给url添加query字符串的方式由A页面向B页面传递数据值。query?可以存在与页面加载中,也可存在小程序初始化或者启动中。
在Page中获取query
//a页面,跳转代参
my.redirectTo({
url: "/pages/face/face?orderNo="+res.data.orderNo+'&totalFee='+res.data.totalFee
})
//b页面,接参
onLoad(query) {
console.log(query); //{orderNo: "2020031316080112160106229622v", totalFee: "0.02"}
}