Ver Fonte

首页poster加载优化,首页内容图片延迟加载

ming há 1 ano atrás
pai
commit
9db5527a8b
2 ficheiros alterados com 5 adições e 3 exclusões
  1. 3 1
      assets/js/commonVue.js
  2. 2 2
      index.html

+ 3 - 1
assets/js/commonVue.js

@@ -251,7 +251,9 @@ const App = {
           setTimeout(() => {
             if (_this.modelType == 2) {
               document.getElementById("videoPlay").src = _this.columnImage; //url为你需要播放的视频地址
-              document.getElementById("videoPlay").setAttribute('poster', '/assets/img/banner/poster.jpg');
+              if(!document.getElementById("videoPlay").getAttribute('poster')){
+                document.getElementById("videoPlay").setAttribute('poster', '/assets/img/banner/poster.jpg');
+              }
             }
           }, 100)
         }

+ 2 - 2
index.html

@@ -91,7 +91,7 @@
                     style="width:100%;height:100%;background-size:cover;background-position:center center;background-repeat:no-repeat;"
                     v-bind:style="{backgroundImage:'url('+columnImage+')'}"></div>
     
-                <video webkit-playsinline="webkit-playsinline" playsinline v-else id="videoPlay" autoplay loop muted preload="auto"
+                <video webkit-playsinline="webkit-playsinline" playsinline v-else id="videoPlay" autoplay loop muted preload="auto" poster="assets/img/banner/poster.jpg"
                     style="width:100%;height:100%;object-fit:fill;">
                     <source type="video/mp4">
                 </video>
@@ -119,7 +119,7 @@
                 <span class="go_down"></span>
             </div>
     
-            <section>
+            <section v-if="columnList.length>1&&contentBoolean">