From 66a479fb2ebf05bf1c63a31f0da686a062ee2b9a Mon Sep 17 00:00:00 2001 From: han2015 <1019850453@qq.com> Date: Mon, 21 Jul 2025 13:48:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6=E5=A4=B9?= =?UTF-8?q?=E5=88=86=E4=BA=AB=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/doc/tools.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/views/doc/tools.ts b/src/views/doc/tools.ts index 32abeae..f4775cb 100644 --- a/src/views/doc/tools.ts +++ b/src/views/doc/tools.ts @@ -92,14 +92,16 @@ export function readableSize(val:matterInfo){ export function fileType(name:string){ - const suffix=name.match(/(\.[a-zA-Z]+$)/)[0] - if (".doc, .docx, .html, .md, .txt, .wps, .xml".includes(suffix)){ + const suffix=name.match(/(\.[a-zA-Z]+$)/) + if(suffix==null){ return ""} + + if (".doc, .docx, .html, .md, .txt, .wps, .xml".includes(suffix[0])){ return "word" - } else if(".csv, .xls, .xlsb, .xlsm, .xlsx".includes(suffix)){ + } else if(".csv, .xls, .xlsb, .xlsm, .xlsx".includes(suffix[0])){ return "cell" - }else if(".ppt, .pptm, .pptx".includes(suffix)){ + }else if(".ppt, .pptm, .pptx".includes(suffix[0])){ return "slide " - }else if (suffix===".pdf"){ + }else if (suffix[0]===".pdf"){ return "pdf" } return ""