<template>
	<view>
		<view class="videoList">
			<view class="title">{{videoList[0].title}}</view>
			<view class="list">
				<!-- <view class="item" v-for="item in videoList" :key="item.id">
					<view class="name">{{item.videoName}}</view>
					<view class="icon" @click="detail(item.videoUrl,item.videoName)">
						<uni-icons type="videocam" size="24" color="#009FE8"></uni-icons>
					</view>
				</view> -->
				<view class="item" v-for="item in videoList" :key="item.id" v-if="item.videoUrl != ''">
					<video :poster="poster[poster_index]" :src="item.videoUrl" controls object-fit="fill" style="width: 100%;"></video>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props:[
			"videoList"
		],
		data() {
			return {
				poster:[
					"https://img1.baidu.com/it/u=574276659,2777898124&fm=253&fmt=auto&app=138&f=JPEG?w=550&h=364"
				],
				poster_index:0
			};
		},
		mounted() {
			// this.poster_index = Math.floor(Math.random()*10)
			// console.log(this.poster_index)
		},
		methods:{
			detail(path,name){
				console.log(path)
				uni.navigateTo({
					url:"../../index/record/record-video/record-video?name=" + name + "&url=" + path
				})
			}
		}
	}
</script>

<style lang="scss">
	.videoList{
		.title{
			line-height: 30px;
			border-left: 4px solid #009FE8;
			border-radius: 4px;
			padding-left: 10px;
			margin-bottom: 10px;
		}.list{
			.item{
				// padding: 20rpx 25rpx;
				// border-bottom: 1rpx solid #f4f4f4;
				margin-bottom: 20rpx;
				border-radius: 14rpx;
				overflow: hidden;
				
				display: flex;
				justify-content: space-between;
				.name{
					white-space: nowrap;
					overflow: hidden; 
					text-overflow:ellipsis;
				}
				.icon{
					padding-left: 50rpx;
				}
			}
		}
	}
</style>
