소스 검색

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

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';