使用wx.navigateTo传参时参数过大会导致页面无法接受参数吗?这边会报错

小程序 文章 2021-04-07 16:42 507 0 全屏看文

AI助手支持GPT4.0

使用wx.navigateTo传参时参数过大会导致页面无法接受参数吗?这边会报错When using wx.navigateTo to pass parameters, will the page fail to accept the parameters because the parameters are too large? An error will be reported here

使用wx.navigateTo传参时参数过大会导致页面无法接受参数吗?这边会报错

请问有谁碰到这种情况吗?我用navigateTo传参时也用JSON.stringfy和JSON.parse转换了,但是传过去有的是可以传成功的,有的参数直接就报上面的错误了,我试着把参数拆开来传过去就可以了,是因为参数太多了吗?但是这样会很麻烦,后面还有更多参数需要传,大佬帮看下是啥问题呀?

Is there anyone in this situation? I also use navigator to pass parameters JSON.stringfy and JSON.parse It's converted, but some of the parameters can be passed successfully, and some of the parameters directly report the above error. I try to split the parameters and pass them. Is it because there are too many parameters? But this will be very troublesome. There are more parameters to pass. What's the problem for you?

回答:

Mr.Zhao:

参数过长会被截断

熊先森:真的是过长问题呀,目前有解决办法吗
Mr.Zhao:查询的代码挪到目标页或者本地缓存  全局变量
卢霄霄:

不是过长,是有非法的字符,encodeURIComponent包一下了传

没有然后:

试试存全局或者存storage

熊先森:好我试试

-EOF-

AI助手支持GPT4.0