From 686e9cb12978d559130f816e5c2d2854a13c2f48 Mon Sep 17 00:00:00 2001 From: wente <329538422@qq.com> Date: 星期三, 22 五月 2024 08:43:31 +0800 Subject: [PATCH] svgEditor --- web/src/views/modules/sysPictureBase/SysPictureBase-AddOrUpdate.vue | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/web/src/views/modules/sysPictureBase/SysPictureBase-AddOrUpdate.vue b/web/src/views/modules/sysPictureBase/SysPictureBase-AddOrUpdate.vue index 412fe0c..6a2a3dd 100644 --- a/web/src/views/modules/sysPictureBase/SysPictureBase-AddOrUpdate.vue +++ b/web/src/views/modules/sysPictureBase/SysPictureBase-AddOrUpdate.vue @@ -114,8 +114,9 @@ async uploadSvgContent(event) { const iframeWindow = this.$refs.myIframe.contentWindow const file = event.target.files[0]; + console.log(file,'file file') // 鍙互鍦ㄨ繖閲岃繘琛岃繘涓�姝ョ殑鏂囦欢澶勭悊锛屾瘮濡傝鍙栨枃浠跺唴瀹圭瓑鎿嶄綔 - if (file) { + if (file && file.type==='image/svg+xml') { const reader = new FileReader(); reader.onload = (e) => { const fileContent = e.target.result; @@ -123,6 +124,9 @@ iframeWindow.setSvgContent(fileContent) } reader.readAsText(file); // 浠ユ枃鏈舰寮忚鍙栨枃浠跺唴瀹� + }else { + this.$message({message: '璇烽�夋嫨SVG鍥剧墖', type: 'warning'}) + return false; // 鍙栨秷鎿嶄綔 } // iframeWindow.setSvgContent(data) // 浣跨敤form琛ㄥ崟鐨勬暟鎹牸寮� -- Gitblit v1.9.1