微信小程序页面跳转过程的参数传递
- 普通参数
wx.navigateTo({ url: "../api/getOrderList?orderStatus=" + 0 })
- 多个普通参数(多个参数之间使用
&
分割)
wx.navigateTo({ url: "../api/getOrderList?orderStatus=" + 0 + "&psize=" + 10 +"&pno="1 });
- 传递对象(对象中不带字符
?
)
let params = { orderStatus:0, psize:10, pno:1 };
wx.navigateTo({ url: "../api/getOrderList?params=" + JSON.stringify(params) });
接收页:
onLoad: function(options){
let params = JSON.parse(options.params);
}
- 传递对象(对象中带
?
)
let params = {
orderStatus: 0,
psize: 10,
pno: 1,
picUrl: "https://xxx.com/sources/images/goods/653435.png?x-oss-process=image/resize,m_fill,w_500,h_500/quality,q_90"
};
wx.navigateTo({ url: "../api/getOrderList?params=" + encodeURIComponent(JSON.stringify(params)) });
接收页:
onLoad:function(options)
let params = JSON.parse(decodeURIComponent(options.params));
this.setData({ parms });
}
-End-