跳转时处理
const params = {
url:'hhtp://www.baidu.com?a=1'
}
const queryString = Object.keys(params).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`).join('&');
wx.navigateTo({
url: `../../toPageView/toPageView?${queryString}`,
})
webview页面接受参数
<web-view src="{{url}}" />
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log(options);
let obj = decodeURIComponent(options.url)
console.log(obj);
this.setData({
url: obj
})
console.log(this.data.url);
},