upload project
This commit is contained in:
commit
06961cae04
422 changed files with 110626 additions and 0 deletions
43
pages/webview/webview.js
Normal file
43
pages/webview/webview.js
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
// webview 页面
|
||||
Page({
|
||||
data: {
|
||||
url: ''
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
if (options && options.url) {
|
||||
try {
|
||||
const decodedUrl = decodeURIComponent(options.url);
|
||||
this.setData({
|
||||
url: decodedUrl
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('URL解码失败:', e);
|
||||
this.setData({
|
||||
url: options.url
|
||||
});
|
||||
}
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '缺少URL参数',
|
||||
icon: 'none'
|
||||
});
|
||||
setTimeout(() => {
|
||||
wx.navigateBack();
|
||||
}, 1500);
|
||||
}
|
||||
},
|
||||
|
||||
onMessage(e) {
|
||||
console.log('收到webview消息:', e.detail.data);
|
||||
},
|
||||
|
||||
onError(e) {
|
||||
console.error('webview加载错误:', e);
|
||||
wx.showToast({
|
||||
title: '页面加载失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue