Kaynağa Gözat

优化视频过多卡顿方案

pansl 1 yıl önce
ebeveyn
işleme
11d678f609
1 değiştirilmiş dosya ile 4 ekleme ve 3 silme
  1. 4 3
      pages/video/index.nvue

+ 4 - 3
pages/video/index.nvue

@@ -10,8 +10,9 @@
 			<swiper :style="'width: '+ windowWidth +'px; height:100vh; background-color: #000;'" class="swiper"
 				:circular='false' @change="swiperChange" :current="swiperCurrent" :vertical="true" duration="200">
 				<block v-for="content in swiperList" :key="content">
-					<swiper-item>
-						<view :style="'width: '+ windowWidth +'px; height:'+heightxw+'vh;'" v-if="isShowVideo(content)">
+					<swiper-item :key="content">
+						<view :style="'width: '+ windowWidth +'px; height:'+heightxw+'vh;'"
+							v-if="isShowVideo(content) && shouldRender(content)">
 							<!-- @controlstoggle="controlstoggle" -->
 							<video v-if="isShowVideo(content)" autoplay :key="content" id="myVideo" :controls="controls"
 								:loop="!isplay" preload="auto" :enable-progress-gesture="true"
@@ -69,7 +70,7 @@
 								<text class="userName">选集</text>
 							</view>
 						</view>
-						<image v-if="shouldRender(content)"
+						<image v-if="shouldRender(content) && !isShowVideo(content)"
 							:style="'width: '+ windowWidth +'px; height:'+heightxw+'vh;'" :src="videoInfo.cover_image">
 						</image>
 					</swiper-item>