33 lines
635 B
Vue
33 lines
635 B
Vue
<template>
|
|
<view>
|
|
<u-navbar :title="title" :border-bottom="false"></u-navbar>
|
|
<web-view :src="url" @message="handleMessage"></web-view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
url: "",
|
|
title: "",
|
|
};
|
|
},
|
|
onLoad(options) {
|
|
// 接收传入的URL参数
|
|
|
|
if (options.data) {
|
|
const data = JSON.parse(decodeURIComponent(options.data));
|
|
this.url = data.url;
|
|
this.title = data.name;
|
|
}
|
|
},
|
|
methods: {
|
|
handleMessage(event) {
|
|
// 处理web-view发送的消息
|
|
console.log("来自网页的消息", event.detail);
|
|
},
|
|
},
|
|
};
|
|
</script>
|