<template>
<view>
<view class="page-body">
<view class="page-section" v-for=" (item ,index) in list">
<video id="myVideo" :src="item.src" @error="videoErrorCallback" object-fit="cover" ref="myvideo"></video>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
title: 'video',
list:[
{
src:'/static/1.mp4',
},
{
src:'/static/1.mp4',
},
{
src:'/static/1.mp4',
}
],
windowWidth:'',
windowHeight:'',
}
},
onShow() {
},
onReady: function (res) {
this.videoContext = uni.createVideoContext('myVideo')
//console.log(this.videoContext)
},
onPageScroll(e) {
console.log(e)
},
methods: {
}
}
</script>
<style>
.page-section{
width: 100%;
height: 100%;
position: fixed;
background-color: #000;
/* z-index: 3; */
}
.page-section video{
width: 100%;
height: 100%;
object-fit: cover;
}
</style>
让视频铺满全屏显示
于 2023-06-05 14:39:01 首次发布