webview.js
999 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
41
42
43
44
45
46
47
48
49
let app = getApp();
Page({
data: {
isShow: false, // 控制组件显示隐藏
url: '',
message: "-",
},
onShareAppMessage(options) {
return {
title: 'title',
path: this.url,
success: function (res) {
// that.web_url = return_url
// 转发成功
wx.showToast({
title: "转发成功",
icon: 'success',
duration: 2000
})
},
fail: function (res) {
// 转发失败
}
}
},
onLoad(options = {}) {
let url = options.url;
url = "https://k.wxpai.cn/IdgW/index.html"
console.log("url:", url);
if (url) {
this.setData({
url: url,
isShow: true
})
} else {
// wx.showToast({
// title: '未找到页面地址',
// title: 'none',
// });
}
},
onBindMessage(e) {
let postMessageData = e.detail.data[0]
let openid = postMessageData.openid;
app.store.setItem("openid", openid);
}
})