提交 1cdd1c58 编写于 作者: DCloud-yinjiacheng's avatar DCloud-yinjiacheng

更新web-view示例

上级 c724683b
...@@ -23,6 +23,9 @@ ...@@ -23,6 +23,9 @@
<button type="primary" @click="stop">停止加载</button> <button type="primary" @click="stop">停止加载</button>
</view> </view>
</view> </view>
<view class="uni-btn-v">
<button type="primary" @click="nativeToWeb">原生和Web通信</button>
</view>
</view> </view>
</view> </view>
</template> </template>
...@@ -36,7 +39,7 @@ ...@@ -36,7 +39,7 @@
progress: { progress: {
color: '#FF3333' color: '#FF3333'
} }
} as UTSJSONObject }
} }
}, },
methods: { methods: {
...@@ -52,6 +55,9 @@ ...@@ -52,6 +55,9 @@
stop() { stop() {
(this.$refs['web-view'] as IWebViewNode).stop(); (this.$refs['web-view'] as IWebViewNode).stop();
}, },
nativeToWeb() {
(this.$refs['web-view'] as IWebViewNode).evalJS("alert('hello uni-app x')");
},
message(event : WebViewMessageEvent) { message(event : WebViewMessageEvent) {
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.
先完成此消息的编辑!
想要评论请 注册