You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
crmeb/app/pages/webview/webview.vue

38 lines
752 B

<template>
<web-view :src="url" @message="handleMessage" @load="handleLoad" @error="handleError"></web-view>
</template>
<script>
export default {
data() {
return {
url: '',
}
},
onLoad() {
const eventChannel = this.getOpenerEventChannel();
eventChannel.on('acceptData', (data) => {
this.url = data.url;
});
},
methods: {
handleMessage(e) {
console.log(e.detail.data);
const data = e.detail.data || [];
const eventChannel = this.getOpenerEventChannel();
eventChannel.emit('callbackData', data[0] || {});
},
// 加载完成
handleLoad(e) {
},
// 加载失败
handleError(e) {
uni.showToast({ title: '加载失败', icon: 'none' });
}
}
}
</script>
<style>
</style>