a3892636 by simon

no message

1 parent cee15072
......@@ -20,6 +20,7 @@
"pages/sign-in-record/sign-in-record",
"pages/rank/rank",
"pages/rank-gift/rank-gift",
"pages/webview/webview",
"pages/example/example",
"pages/more/more"
],
......
let app = getApp();
Page({
data: {
isShow: false, // 控制组件显示隐藏
url: ''
},
onLoad: function (options = {}) {
let url = options.url;
if (url) {
this.setData({
url: url,
isShow: true
})
} else {
wx.showToast({
title: '未找到页面地址',
title: 'none',
});
}
}
data: {
isShow: false, // 控制组件显示隐藏
url: ''
},
onLoad(options = {}) {
let url = options.url;
if (url) {
this.setData({
url: url,
isShow: true
})
} else {
wx.showToast({
title: '未找到页面地址',
title: 'none',
});
}
},
onBindMessage(e) {
console.log("webview message:", e);
}
})
......
<view class="loading-wrap">
<view class="loading">
<view class="icon"></view>
<view class="text">加载中...</view>
</view>
<view class="loading">
<view class="icon"></view>
<view class="text">加载中...</view>
</view>
</view>
<web-view wx:if="{{isShow}}" src="{{url}}" bindload="loadSucc"/>
<web-view wx:if="{{isShow}}" src="{{url}}" bindload="loadSucc" bindmessage="onBindMessage" />
......