<template>
	<web-view v-if="url.length" :src="url" @error="errorHandle"></web-view>
</template>

<script>
	export default {
		data() {
			return {
				url: '',
			}
		},
		onLoad(param) {
			if(param.url){
				console.log(param.url)
				this.url = param.url;
			}else{
				this.$app.popup.alert('未设定访问地址','访问失败').then(()=>{
					this.$app.url.back();
				});
			}
		},
		methods:{
			errorHandle(e){
				this.$app.popup.alert('失败原因\r\n'+e.detail.errMsg,'访问失败').then(()=>{
					this.$app.url.back();
				});
			},
		}
	}
</script>