主要使用uniapp swiper 根据后端传递type判断是图片,还是视屏
<view class="screen-swiper">
<swiper style="height: 900rpx;" @change="change" class="screen-swiper" indicator-dots="true" circular="true" :autoplay="!autoplay">
<swiper-item style="width: 750rpx;height: 900rpx;" @click="PlayVideo(item)" v-for="(item, index) in videoList" :key="item.id">
<image style="width: 750rpx;height: 900rpx;" v-if="!item.isPlay" :src="item.src" mode="aspectFill"></image>
<video style="width: 750rpx;height: 900rpx;" v-else id="myVideo" :src="item.vide" :autoplay="true" :enable-progress-gesture="false" loop muted show-play-btn controls objectFit="cover" @pause="suspend" @ended="suspend"></video>
</swiper-item>
<swiper-item style="width: 750rpx;height: 900rpx;" v-for="(item, index) in imageList" :key="item.id"><image style="width: 750rpx;height: 900rpx;" :src="item.src" mode="aspectFill"></image></swiper-item>
</swiper>
</view>
data代码
autoplay: false,
list: [
{
id: '',
isPlay: false,
type: 1,
src: ''
}
]
computed代码
videoList() {
return this.list.filter(item => {
return item.type == 2;
});
},
imageList() {
return this.list.filter(item => {
return item.type == 1;
});
}
onReady代码
this.videoContext = uni.createVideoContext('myVideo');
methods 代码
change(e) {
if (e.detail.current != 0) {
this.list[0].isPlay = false;
that.autoplay = false;
if(this.list[0].type==2)
that.videoContext.pause();
}
},
PlayVideo(item) {
if (item.isPlay == false) {
item.isPlay = true;
that.videoContext.play();
that.autoplay = true;
} else {
item.isPlay = false;
that.autoplay = false;
that.videoContext.pause();
}
},
suspend(i) {
if (that.autoplay == true) {
that.autoplay = false;
}
}
css代码 根据自己的方式调
.screen-swiper {
min-height: 675upx;
}
.screen-swiper {
width: 750rpx;
}
ASP.Net Core的跨域设置比较简单 官方都整合了 具体的参见微软官方文档: https:...
Coonamd 对象定义了将对数据源执行的命令,可以用于查询数据库表并返回一个记录...
常见信号介绍 SIGINT 2 CtrlC时OS送给前台进程组中每个进程 SIGABRT 6 调用abort...
当我们学习surface命令时,已经看到了三维作图的一些端倪。在matlab中我么可以调...
本文介绍了JSP编程技术实现一个简单的购物车程序,具体如下: 1 问题描述 利用JS...
由于工作所需,最近花时间研究了html转换为pdf的功能。html转换为pdf的关键技术...
1.有时候,那些清晨时最坚强的人,正是那些夜里哭着哭着睡着的人。 2.总有一个...
第二题 2021年4月4日 腾讯笔试编程题第二题 描述 给出一个有0-9的数字组成的字符...
XML/HTML Code 复制内容到剪贴板 input id = username name = username type = t...
作者个人研发的在高并发场景下,提供的简单、稳定、可扩展的延迟消息队列框架,...