1.A页面传递对象

godetail(e) {
	uni.navigateTo({
		url:`/pages/serve/index?data=${encodeURIComponent(JSON.stringify(e))}`
	})
}

2.B页面接收

onLoad(options) {
	let obj = JSON.parse(decodeURIComponent(options.data))
    console.log(obj)
}

encodeURIComponent() 函数可把字符串作为 URI 组件进行编码。

decodeURIComponent() 函数可对 encodeURIComponent() 函数编码的 URI 进行解码。

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐