提交 4bee2279 编写于 作者: H hdx

webview: 框架已支持,移除临时写法

上级 31932989
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
switch (action) { switch (action) {
case 'switchTab': case 'switchTab':
uni.switchTab({ uni.switchTab({
url: '/pages/tabBar/API/API' url: '/pages/tabBar/API'
}); });
break; break;
case 'reLaunch': case 'reLaunch':
......
...@@ -10,47 +10,11 @@ ...@@ -10,47 +10,11 @@
export default { export default {
data() { data() {
return { return {
} }
}, },
methods: { methods: {
message(event : WebViewMessageEvent) { message(event : WebViewMessageEvent) {
console.log(JSON.stringify(event.detail)); console.log(JSON.stringify(event.detail));
const data = event.detail.data;
if (data == null) return;
switch (data['action']) {
case 'navigateTo':
uni.navigateTo({
url: data['url'] as string
});
break;
case 'redirectTo':
uni.redirectTo({
url: data['url'] as string
});
break;
case 'switchTab':
uni.switchTab({
url: data['url'] as string
});
break;
case 'reLaunch':
uni.reLaunch({
url: data['url'] as string
});
break;
case 'navigateBack':
uni.navigateBack({
delta: data['delta'] as number
});
break;
default:
uni.showModal({
content: JSON.stringify(event.detail),
showCancel: false
});
break;
}
}, },
error(event : WebViewErrorEvent) { error(event : WebViewErrorEvent) {
console.log(JSON.stringify(event.detail)); console.log(JSON.stringify(event.detail));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册