uni.navigateTo传递对象类型的参数

一,传递一个参数

传递页面代码:

visualPage(){
           var that=this
           var editItem=that.pageModel
            uni.navigateTo({url:'/pages/visualPage/index?editItem='+encodeURIComponent(JSON.stringify(editItem))})
        }

跳转页面代码:(这里的option会识别传入参数类型为数组)

 onLoad(option){
    const editItem = JSON.parse(decodeURIComponent(option.editItem));
  },

二,传递多个参数

传递页面代码:

 var seal=this.pageModel.seal;
           var cStorageModel=this.storageModel
            uni.navigateTo({url:'/pages/setSeal/index?seal='+encodeURIComponent(JSON.stringify(seal))+"&cStorageModel"+encodeURIComponent(JSON.stringify(cStorageModel))})

跳转页面代码:

 onLoad(option){
    this.pageModel.sealAuth = JSON.parse(decodeURIComponent(option.sealAuth));
    this.pageModel.cStorageModel = JSON.parse(decodeURIComponent(option.cStorageModel));
  },

你可能感兴趣的:(uni-app)