kevin.T 4 hafta önce
ebeveyn
işleme
f54fccbffe

+ 8 - 4
packages/app/src/pages/home/components/home-banner.vue

@@ -29,6 +29,9 @@ const handleEnded = () => {
   videoContext.value?.pause()
   emits('ended', props.id)
 }
+const handlePause = () => {
+  playing.value = false
+}
 onMounted(async () => {
   videoContext.value = uni.createVideoContext(`video-${props.id}`, instance)
 })
@@ -38,7 +41,10 @@ defineExpose({
 </script>
 <template>
   <div class="w-full h-full relative">
-    <div class="w-full h-full box-border pb-6">
+    <div v-show="!playing" class="absolute left-0 top-0 w-full h-full bg-black">
+      <ImageEvo :src="cover"></ImageEvo>
+    </div>
+    <div class="w-full h-full box-border pb-6" v-show="playing">
       <video
         class="w-full h-full"
         :id="`video-${id}`"
@@ -47,13 +53,11 @@ defineExpose({
         :show-center-play-btn="false"
         :enable-progress-gesture="false"
         :loop="false"
+        @pause="handlePause"
         @ended="handleEnded"
         @loadedmetadata="handleLoadedMetaData"
       ></video>
     </div>
-    <div v-if="!playing" class="absolute left-0 top-0 w-full h-full bg-black">
-      <ImageEvo :src="cover"></ImageEvo>
-    </div>
     <div
       v-if="!playing"
       class="w-[375px] h-[90px] bg-gradient-to-t from-black to-black/0 absolute left-0 bottom-0 w-full flex items-center"