<template>
	<view :style="{display: isShow ? 'block' : 'none'}" class="ad-view">
		<ad :unit-id="unitId" :ad-intervals="adIntervals" :ad-type="adType" @error="onerror" @load="onload"></ad>
	</view>
</template>

<script>
	export default {
		name:"ad-view",
		props: {
			// 广告id
			unitId: {
				type: String,
				default: ""
			},
			// 广告自动刷新时间
			adIntervals: {
				type: String,
				default: '100'
			},
			adType: {
				type: String,
				default: 'banner'
			}
		},
		data() {
			return {
				isShow: true
			};
		},
		methods: {
			onload(e) {
				this.isShow = true
			},
			onerror(e) {
				this.isShow = false
			}
		}
	}
</script>

<style>
	// banner广告
	.ad-view {
		overflow: hidden;
		border-radius: 20rpx;
		margin-top: 28rpx;
	}
</style>