From 85cbb9a62a4f3a6b3c0cd241976c351eb0d7ed9b Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期五, 28 三月 2025 16:23:00 +0800 Subject: [PATCH] art: 预览代码问题修正 --- src/components/jeecg/LxFilePreview.vue | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/components/jeecg/LxFilePreview.vue b/src/components/jeecg/LxFilePreview.vue index 6017a26..9d01b89 100644 --- a/src/components/jeecg/LxFilePreview.vue +++ b/src/components/jeecg/LxFilePreview.vue @@ -9,10 +9,10 @@ :footer="null" cancelText="鍏抽棴"> <a-spin :spinning="confirmLoading"> - <img v-if="isImage" :src="fileUrl" width="100%" height="100%" alt="鍥剧墖棰勮" /> - <iframe v-else-if="isPdf" :src="fileUrl" width="100%" height="600px"></iframe> + <img v-if="isImage" :src="localFileUrl" width="100%" height="100%" alt="鍥剧墖棰勮" /> + <iframe v-else-if="isPdf" :src="localFileUrl" width="100%" height="600px"></iframe> <video v-else-if="isVideo" controls> - <source :src="fileUrl" type="video/mp4"> + <source :src="localFileUrl" type="video/mp4"> 鎮ㄧ殑娴忚鍣ㄤ笉鏀寔 video 鏍囩銆� </video> <pre v-else-if="isText">{{ textContent }}</pre> @@ -33,25 +33,26 @@ title: '棰勮', textContent: '', confirmLoading: false, - visible: false + visible: false, + localFileUrl: this.fileUrl, } }, computed: { isImage() { - return /\.(jpeg|jpg|png|gif|bmp|webp)$/i.test(this.fileUrl) + return /\.(jpeg|jpg|png|gif|bmp|webp)$/i.test(this.localFileUrl) }, isPdf() { - return /\.pdf$/i.test(this.fileUrl) + return /\.pdf$/i.test(this.localFileUrl) }, isVideo() { - return /\.(mp4|webm|ogg)$/i.test(this.fileUrl) + return /\.(mp4|webm|ogg)$/i.test(this.localFileUrl) }, isText() { - return /\.(txt|md|json|xml|yaml|yml)$/i.test(this.fileUrl) + return /\.(txt|md|json|xml|yaml|yml)$/i.test(this.localFileUrl) } }, watch: { - fileUrl: 'fetchTextContent' + localFileUrl: 'fetchTextContent' }, mounted() { if (this.isText) { @@ -77,7 +78,7 @@ preview(fileUrl) { let url = getFileAccessHttpUrl(fileUrl) this.visible = true - this.fileUrl = url + this.localFileUrl = url }, handleOk() { this.close() -- Gitblit v1.9.3