Files
xiuhuwangqiu/pages/webview/webview.vue
wangxiaowei 90c54df48b first commit
2025-10-22 22:56:36 +08:00

28 lines
420 B
Vue

<template>
<view>
<web-view :src="url" @onPostMessage="handlePostMessage"></web-view>
</view>
</template>
<script>
export default {
data() {
return {
url: ''
}
},
onLoad(e) {
this.url = e.url;
},
methods: {
// webview向外部发送消息
handlePostMessage: function(data) {
console.log("接收到消息:" + JSON.stringify(data.detail));
},
}
}
</script>
<style>
</style>