Browse Source

bugfix: 修复文件预览大写后缀不展示的问题

北桥 1 year ago
parent
commit
34c0d2d277
1 changed files with 4 additions and 5 deletions
  1. 4 5
      src/views/system/oss/index.vue

+ 4 - 5
src/views/system/oss/index.vue

@@ -197,11 +197,10 @@ const getList = async () => {
   loading.value = false;
   showTable.value = true;
 };
-function checkFileSuffix(fileSuffix: string[]) {
-  let arr = ['png', 'jpg', 'jpeg'];
-  return arr.some((type) => {
-    return fileSuffix.indexOf(type) > -1;
-  });
+function checkFileSuffix(fileSuffix: string | string[]) {
+  const arr = [".png", ".jpg", ".jpeg"];
+  const suffixArray = Array.isArray(fileSuffix) ? fileSuffix : [fileSuffix];
+  return suffixArray.some(suffix => arr.includes(suffix.toLowerCase()));
 }
 /** 取消按钮 */
 function cancel() {