uni.navigateTo页面跳转时传对象参数

Posted 尔嵘

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了uni.navigateTo页面跳转时传对象参数相关的知识,希望对你有一定的参考价值。

A页面要传的对象参数:

注:encodeURIComponent(JSON.stringify(对象))

//跳转详情
handleAlarmDetailById(e)
    //e是一个对象类型参数
    uni.navigateTo( url: "/indexHugerol/pages/alopmdetail/index?alarmDetail=" + encodeURIComponent(JSON.stringify(e)) )
,

B页面接收参数:

注:JSON.parse(decodeURIComponent(前面传的参数))

onLoad(options) 
    this.alarmDetail = JSON.parse(decodeURIComponent(options.alarmDetail));
,

然后,就可以直接使用这个参数了

以上是关于uni.navigateTo页面跳转时传对象参数的主要内容,如果未能解决你的问题,请参考以下文章