提交 3c7ca9e2 编写于 作者: DCloud_JSON's avatar DCloud_JSON

Update swiper-vertical-video.uvue

上级 5b3cbc37
...@@ -5,7 +5,11 @@ ...@@ -5,7 +5,11 @@
</view> </view>
<swiper class="swiper" :current="current" :circular="index != 0" :vertical="true" @change="onSwiperChange" @transition="onTransition"> <swiper class="swiper" :current="current" :circular="index != 0" :vertical="true" @change="onSwiperChange" @transition="onTransition">
<swiper-item class="swiper-item" v-for="(item,i) in visibleList" :key="i"> <swiper-item class="swiper-item" v-for="(item,i) in visibleList" :key="i">
<video ref="video" class="video-box" objectFit="cover" :id="'video-'+i" @loadstart="onLoadstart(i)" :src="item.src" :poster="item.poster_src" :show-center-play-btn="false" :autoplay="false" :controls="false" :loop="true" @play="onPlay(i)" @pause="onPause(i)"></video> <video @click="changeState(i)" ref="video" class="video-box" objectFit="cover" :id="'video-'+i"
@loadstart="onLoadstart(i)" :src="item.src" :poster="item.poster_src"
:autoplay="false" :show-center-play-btn="false"
:loop="true" @play="onPlay(i)" @pause="onPause(i)"
></video>
<view class="video-cover" @click="changeState(i)"> <view class="video-cover" @click="changeState(i)">
<image v-if="state[i] === 'pause'" class="play-btn" src="/static/template/swiper-vertical-video/play.png" mode="widthFix"></image> <image v-if="state[i] === 'pause'" class="play-btn" src="/static/template/swiper-vertical-video/play.png" mode="widthFix"></image>
</view> </view>
...@@ -121,12 +125,8 @@ ...@@ -121,12 +125,8 @@
}, },
doStop(index : number) { doStop(index : number) {
console.log("doStop video-" + index); console.log("doStop video-" + index);
this.getVideoContext(index).stop();
// this.getVideoContext(index).stop() // TODO 临时方案:解决.stop()时触发了doPause的问题
// TODO 临时方案: 暂不支持stop(),先调用暂停并将播放时间归零
this.getVideoContext(index).pause()
this.getVideoContext(index).seek(0)
setTimeout(()=>{ setTimeout(()=>{
this.state[index] = 'unPlay' this.state[index] = 'unPlay'
},1000) },1000)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册