uni-app uView2.0轮播图+视频的坑
uni-app uView2.0轮播图+嵌入视频在H5正常,但是在app手机上不支持!!!
视频默认是暂停播放,当轮播图有视频的时候点击播放视频,左右滑动轮播图的时候,将视频暂停即可左右滑动轮播图
<!-- 轮播图+视频 --> <view class="swiperImg"> <swiper class="screen-swiper" indicator-dots="true" circular="true" :autoplay="!autoplay" interval="3500" duration="500"> <swiper-item @tap="item.type == 'video' ? BoFang() : onClickCommentImg(dataDetails, index)" v-for="(item,index) in dataDetails.yj_desc_img" :key="index"> <image v-if="item.type == 'image'" :src="item.yj_path" mode="widthFix"></image> <view class="videoWrap" v-else> <u--image class="videoBtn" src="/static/img/iconImg/56.png" width="64rpx" height="64rpx" v-if="!autoplay"></u--image> <video class="videoItem" style="width: 100%" id="myVideo" :src="item.yj_path" autoplay muted show-play-btn objectFit="cover" @ended="autoplay = false" @pause="autoplay = false" v-else></video> </view> </swiper-item> </swiper> </view>
根据后台返的数据判断,有视频的时候插入到轮播图列表里
点击播放视频