shaogen1995 3 anni fa
parent
commit
de24ef1e55
1 ha cambiato i file con 15 aggiunte e 3 eliminazioni
  1. 15 3
      src/views/Home.vue

+ 15 - 3
src/views/Home.vue

@@ -25,7 +25,13 @@
         <p v-html="data.content"></p>
         <p
           v-html="data.imagesDesc[myInd]"
-          v-if="data.imagesDesc && data.imagesDesc[myInd]"
+          v-if="
+            data.imagesDesc && data.imagesDesc[myInd] && active === 'images'
+          "
+        ></p>
+        <p
+          v-html="data.videosDesc[myInd]"
+          v-if="data.videosDesc && data.videosDesc[myInd] && active === 'video'"
         ></p>
       </div>
       <!-- 查看图片 -->
@@ -53,6 +59,7 @@
               :src="fixUrl(item.url)"
               controls
               autoplay
+              muted
             ></video>
             <iframe
               @click="colseParent(item)"
@@ -104,7 +111,11 @@
       <p v-html="data.content"></p>
       <p
         v-html="data.imagesDesc[myInd]"
-        v-if="data.imagesDesc && data.imagesDesc[myInd]"
+        v-if="data.imagesDesc && data.imagesDesc[myInd] && active === 'images'"
+      ></p>
+      <p
+        v-html="data.videosDesc[myInd]"
+        v-if="data.videosDesc && data.videosDesc[myInd] && active === 'video'"
       ></p>
     </div>
   </div>
@@ -184,7 +195,8 @@ export default {
   },
   watch: {
     active(newVal) {
-      if (newVal == "images") this.myInd = 0;
+      let AcDataLength = this.data[newVal].length-1
+      if(this.myInd>AcDataLength) this.myInd = AcDataLength
 
       // 判断是否只有一张图片或者视频,ifrm   lengthShow
       let tempType = this.data[newVal];