当参数的值为url的时候,  ?号   _  下划线   等等 都会被 截取掉,看不到,  这样在 另一个页面 options中  截取的url就不完全

let url="http://baidu_aaa.com/?a=1&b=2"

wx.navigateTo({ url: `detail?url=123` })

 

另一个页面  options.url = http://baidu   这个

 

 

解决方法

可以使用 encodeURIComponent():函数可把字符串作为 URI 组件进行编码,

let url=encodeURIComponent("http://baidu.com/?a=1&b=2")

wx.navigateTo({ url: `detail?url=` + url})

 

在获取的时候decodeURIComponent(options.url)

相关文章:

  • 2022-01-12
  • 2021-07-08
  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
  • 2022-12-23
  • 2022-12-23
  • 2022-02-07
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-14
  • 2021-11-14
  • 2022-02-07
相关资源
相似解决方案