tangning 7 months ago
parent
commit
2229439158
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/components/viewImg/index.vue

+ 6 - 1
src/components/viewImg/index.vue

@@ -144,11 +144,16 @@ const TypeFilter = (url) => {
   const fileType = url.substring(url.lastIndexOf(".")).toLowerCase();
   return fileType;
  }
+ const verifySuffix = (imageName) => {
+  const suffix = `(bmp|jpg|png|tif|gif|pcx|tga|exif|fpx|svg|psd|cdr|pcd|dxf|ufo|eps|ai|raw|WMF|webp|jpeg)`
+  const regular = new RegExp(`.*\.${suffix}`)
+  return regular.test(imageName)
+}
 watchEffect(() => {
   if (props.list.length) {
     console.log(props.list, "watchEffect");
     let newlist = props.list.map(item => item.filesUrl || item.fileUrl);
-    initFileList.value = newlist.filter(item => item.type == 1);
+    initFileList.value = newlist.filter(item => verifySuffix(item.filesUrl));
   }
 });