uni.app 跳外链,跳webview页面
- 前一页面
webView(href) {
var that = this;
let data = {
href: href
};
let query = encodeURIComponent(JSON.stringify(data));
that.goto('/pages/common/webView/webView?key=' + query);
},
- webview页面接收
onLoad(options) {
var that = this;
if (options.key) {
let data = JSON.parse(decodeURIComponent(options.key));
// console.log(data.href);
that.href = data.href;
uni.navigateTo({
url:(window.location.href = that.href)
//url: (window.location.href = “网址”)
})
}
}