提交 09013a92 编写于 作者: H hdx

fix(web-view示例): 调整调用uni API方式,使用uni.webView前缀, uni.xxx 改为 uni.webView.xxx

上级 d13d1f55
...@@ -55,29 +55,29 @@ ...@@ -55,29 +55,29 @@
console.log(action); console.log(action);
switch (action) { switch (action) {
case 'switchTab': case 'switchTab':
uni.switchTab({ uni.webView.switchTab({
url: '/pages/tabBar/API' url: '/pages/tabBar/API'
}); });
break; break;
case 'reLaunch': case 'reLaunch':
uni.reLaunch({ uni.webView.reLaunch({
url: '/pages/tabBar/component' url: '/pages/tabBar/component'
}); });
break; break;
case 'navigateBack': case 'navigateBack':
uni.navigateBack({ uni.webView.navigateBack({
delta: 1 delta: 1
}); });
break; break;
case 'getEnv': case 'getEnv':
uni.getEnv((res) => { uni.webView.getEnv((res) => {
uni.postMessage({ uni.postMessage({
data: res data: res
}) })
}); });
break; break;
default: default:
uni[action]({ uni.webView[action]({
url: '/pages/component/button/button' url: '/pages/component/button/button'
}); });
break; break;
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
}) })
// }); // });
document.querySelector("#postMessage").addEventListener('click', function() { document.querySelector("#postMessage").addEventListener('click', function() {
uni.postMessage({ uni.webView.postMessage({
data: { data: {
action: 'message' action: 'message'
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册