问题
A原本想传递的参数('http://xxx.xxx.xx?info=xxx')
toPageB(){ let res='http://xxx.xxx.xx?info=xxx' uni.navigateTo({ url: "/pages/pageB/index?url=" + res, }); }
B页面获取到的参数('http://xxx.xxx.xx')
onLoad(option) { console.log(option.url); // 'http://xxx.xxx.xx' },
解决办法
使用encodeURIComponent与decodeURIComponent对传递参数进行加解码
// pageA/index.vue toPageB(){ let res='http://xxx.xxx.xx?info=xxx' uni.navigateTo({ url: "/pages/pageB/index?url=" + encodeURIComponent(res), }); } // pageB/index.vue onLoad(option) { console.log(decodeURIComponent(option.url)); // ''http://xxx.xxx.xx?info=xxx' },标签:index,http,url,截取,xxx,传递,xx,参数 From: https://www.cnblogs.com/nicoz/p/17397281.html