tangning 7 月之前
父节点
当前提交
460b818ed2
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      src/hook/upload.ts

+ 4 - 2
src/hook/upload.ts

@@ -36,6 +36,7 @@ export const useUpload = <T>(props: UploadProps<T>) => {
         // return (extMime.substring(0, extMime.indexOf("/") + 1) + ext) as string;
 
         return format;
+
       })
       .join(", ")
   );
@@ -55,9 +56,10 @@ export const useUpload = <T>(props: UploadProps<T>) => {
     const fileType = file.name
       .substring(file.name.lastIndexOf("."))
       .toUpperCase();
-
+    console.log('props.formats', props.formats, format.value);
     if (!props.formats.some((type) => type.toUpperCase() === fileType)) {
-      ElMessage.error(`请上传${format.value}`);
+      let newformat = format.value.replaceAll('.', "") as string;
+      ElMessage.error(`请上传${newformat}`);
       return false;
     } else if (file.size > props.maxSize) {
       ElMessage.error(`请上传${size.value}以内的文件`);