<template>
	<view class="preview-video" v-if="show">
		<uni-icons class="preview-video-icon" type="clear" color="#fff" size="28" @click="$emit('close')"></uni-icons>
		<view class="block" @tap.stop>
			<video class="block-video" autoplay :src="videoUrl"></video>
		</view>
	</view>
</template>

<script>
	export default {
		name: "previewVideo",
		props: {
			videoUrl: {
				type: String,
				default: ''
			},
			show: {
				type: Boolean,
				default: false
			}
		},
		data() {
			return {};
		}
	}
</script>

<style lang="scss">
	.preview-video {
		background-color: $uni-black;
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: 99;

		.block {
			padding: 0 30rpx;
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate(-50%, -50%);
			width: 100%;
		}

		.block-video {
			width: 100%;
		}

		.preview-video-icon {
			position: absolute;
			/* #ifdef MP-WEIXIN */
			top: 40rpx;
			/* #endif */
			/* #ifdef H5 */
			top: 120rpx;
			/* #endif */
			right: 40rpx;

		}
	}
</style>