webview.js
787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
let app = getApp();
Page({
data: {
isOverShare: true,
isShow: false, // 控制组件显示隐藏
url: '',
},
onShareAppMessage(res) {
if (res.from === 'button') {
// 来自页面内转发按钮
}
let url = encodeURIComponent(this.data.url);
let path = `/pages/webview/webview?url=${url}`;
return {
title: "家有儿孙",
path: path,
// imageUrl: ''
}
},
onLoad(options = {}) {
wx.showLoading();
let url = decodeURIComponent(options.url);
if (url) {
this.setData({
url: url,
isShow: true
})
} else {
wx.showToast({
title: '未找到页面地址',
title: 'none',
});
wx.hideLoading();
}
},
loadSucc() {
wx.hideLoading();
}
})