no message
Showing
3 changed files
with
28 additions
and
23 deletions
... | @@ -20,6 +20,7 @@ | ... | @@ -20,6 +20,7 @@ |
20 | "pages/sign-in-record/sign-in-record", | 20 | "pages/sign-in-record/sign-in-record", |
21 | "pages/rank/rank", | 21 | "pages/rank/rank", |
22 | "pages/rank-gift/rank-gift", | 22 | "pages/rank-gift/rank-gift", |
23 | "pages/webview/webview", | ||
23 | "pages/example/example", | 24 | "pages/example/example", |
24 | "pages/more/more" | 25 | "pages/more/more" |
25 | ], | 26 | ], | ... | ... |
1 | let app = getApp(); | 1 | let app = getApp(); |
2 | Page({ | 2 | Page({ |
3 | data: { | 3 | data: { |
4 | isShow: false, // 控制组件显示隐藏 | 4 | isShow: false, // 控制组件显示隐藏 |
5 | url: '' | 5 | url: '' |
6 | }, | 6 | }, |
7 | onLoad: function (options = {}) { | 7 | onLoad(options = {}) { |
8 | let url = options.url; | 8 | let url = options.url; |
9 | if (url) { | 9 | if (url) { |
10 | this.setData({ | 10 | this.setData({ |
11 | url: url, | 11 | url: url, |
12 | isShow: true | 12 | isShow: true |
13 | }) | 13 | }) |
14 | } else { | 14 | } else { |
15 | wx.showToast({ | 15 | wx.showToast({ |
16 | title: '未找到页面地址', | 16 | title: '未找到页面地址', |
17 | title: 'none', | 17 | title: 'none', |
18 | }); | 18 | }); |
19 | } | 19 | } |
20 | } | 20 | }, |
21 | |||
22 | onBindMessage(e) { | ||
23 | console.log("webview message:", e); | ||
24 | } | ||
21 | }) | 25 | }) | ... | ... |
1 | <view class="loading-wrap"> | 1 | <view class="loading-wrap"> |
2 | <view class="loading"> | 2 | <view class="loading"> |
3 | <view class="icon"></view> | 3 | <view class="icon"></view> |
4 | <view class="text">加载中...</view> | 4 | <view class="text">加载中...</view> |
5 | </view> | 5 | </view> |
6 | </view> | 6 | </view> |
7 | <web-view wx:if="{{isShow}}" src="{{url}}" bindload="loadSucc"/> | 7 | <web-view wx:if="{{isShow}}" src="{{url}}" bindload="loadSucc" bindmessage="onBindMessage" /> | ... | ... |
-
Please register or sign in to post a comment