Преглед изворни кода

修改邻里社区图片显示问题

D4THYL3\long пре 3 година
родитељ
комит
e748e2abed
1 измењених фајлова са 9 додато и 5 уклоњено
  1. 9 5
      operationSupport/src/views/propertyManagement/neighbor.vue

+ 9 - 5
operationSupport/src/views/propertyManagement/neighbor.vue

@@ -238,9 +238,11 @@ export default {
     mounted() {},
     methods: {
         typeVideo(str) {
-            let type = str.slice(str.lastIndexOf('.') + 1, str.length);
-            let videoType = ['mp4'];
-            return videoType.includes(type);
+            if (str) {
+                let type = str.slice(str.lastIndexOf('.') + 1, str.length);
+                let videoType = ['mp4'];
+                return videoType.includes(type);
+            }
         },
         lookVideos(src) {
             new Promise((resolve) => {
@@ -326,8 +328,10 @@ export default {
                     if (res.status === 0) {
                         if (res.data.file) {
                             let file = res.data.file;
-                            let mediaList = file.split(',');
-                            this.mediaList.length = 3;
+                            this.mediaList = file.split(',');
+                            if (this.mediaList.length >= 3) {
+                                this.mediaList.length = 3;
+                            }
 
                             this.srcList = this.mediaList.filter((item) => {
                                 return item !== 'mp4';