webview.vue 519 Bytes
<template>
	<view class="container">
		<web-view :src="url" @message="handleMessage"></web-view>
	</view>
</template>

<script setup>
	import { ref } from 'vue';
	import {
		onShow,
		onLoad
	} from '@dcloudio/uni-app'

	const url = ref('');

	onLoad((options) => {
		if (options.url) {
			url.value = decodeURIComponent(options.url);
		}
	});

	const handleMessage = (event) => {
		console.log('收到消息:', event.detail.data);
	};
</script>

<style scoped>
	.container {
		width: 100%;
		height: 100vh;
	}
</style>