小程序url跳转参数丢失

发布时间 2023-12-22 18:49:09作者: Penetration

小程序url跳转参数丢失

使用 encodeURIComponent 进行编码然后用 decodeURIComponent 解码

// 发送
toShopInfo(e) {
			let urlData = JSON.stringify(e.currentTarget.dataset.info);
			wx.navigateTo({
				url: "/pages/shopInfo/shopInfo?info=" + encodeURIComponent(urlData),
			});
		},
// 接收
onLoad(options) {
		console.log("options:", decodeURIComponent(options.info));
	},