<template>
	<web-view v-if="showWeb" :src="'/hybrid/html/uploadFile.html'" @message="postMessage" style="width: 100%;height: 100%;"></web-view>
</template>

<script>
	// import indexConfig from '@/config/index.config';
	let wv = null // html页面实例  
	export default {
		name: "uploadFile",
		data() {
			return {
				//webview显示宽高
				webviewStyles: {
					width: '100%',
					height: '170px'
				},
				funcId: "",
				showWeb: false
			}
		},
		onLoad() {

		},
		mounted() {

		},
		methods: {
			open() {
				this.showWeb = true;
			},
			//接收html页面发送的消息
			postMessage(event) {
				console.log(event)
				let result = event.detail.data[0];
				let str = JSON.stringify(event)
				if (result.type == "success") {
					this.$emit("onmessage", {
						fileList: result.fileList
					});
					this.showWeb = false;
				} else if (result.type == "cancel") {
					this.showWeb = false;
				}
			}
		}
	}
</script>

<style scoped lang="scss">
	.webview_mask {
		position: fixed;
		background-color: rgba(0, 0, 0, 0.7);
		z-index: 2500;
		width: 100%;
		height: 100%;
		top: 0;
		left: 0;
	}
	.webview_box {
		position: fixed;
		top: 50%;
		left: 0;
		background-color: #fff;
		background: #fff;
		z-index: 2502;
		width: 100%;
		height: 200px;
	}
</style>