uni-app微信小程序路由传参数据截断问题解决

发布时间 2023-06-20 19:05:22作者: 爱听书的程序猿

跳转页面:

因为数据接受页面是富文本编辑器接收,所以先是将数据双引号处理了。

数据太多太长,跳转页面只要用encodeURIComponent()函数将其数据处理后传过去

const details = this.oneform.text.replace(/"/g, '\'')
this.$tab.navigateTo(`/pages/common/editor/editor?details=${encodeURIComponent(details)}`)

接收页面:

使用decodeURIComponent()函数将其解析,得到的数据便是想要接收的完整数据

this.editorDetails = decodeURIComponent(option.details);