diff --git a/src/views/system/oss/index.vue b/src/views/system/oss/index.vue index 1cc582e..77c5dcd 100644 --- a/src/views/system/oss/index.vue +++ b/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() {