From 660b451f0d8cfb5550a10f281984be402c81750d Mon Sep 17 00:00:00 2001
From: zhangxiao <898441624@qq.com>
Date: 星期三, 18 九月 2024 16:59:28 +0800
Subject: [PATCH] 为机构管理添加拖拽功能锁定按钮与权限限制

---
 src/views/dmx/knowledgeLib/components/txt.vue |   33 +++++++++++++++++++++++++--------
 1 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/src/views/dmx/knowledgeLib/components/txt.vue b/src/views/dmx/knowledgeLib/components/txt.vue
index 0110ad9..391d664 100644
--- a/src/views/dmx/knowledgeLib/components/txt.vue
+++ b/src/views/dmx/knowledgeLib/components/txt.vue
@@ -1,6 +1,6 @@
 <template>
   <div>
-    <pre v-html="content"></pre>
+    <pre v-text="content"></pre>
   </div>
 </template>
 
@@ -8,6 +8,7 @@
 import { ref, watch } from "vue";
 
 let content = ref("");
+
 //	鑾峰彇鐖剁粍浠朵紶閫掔殑璧勬簮url
 const props = defineProps({
   previewSrc: {
@@ -17,14 +18,30 @@
   }
 });
 
-const getContent = (url) => {
-  fetch(url)
-    .then((res) => res.text())
-    .then((data) => {
-      content.value = data;
-    });
+//鐩戞帶灞炴�reviewSrc鐨勫彉鍖栵紝濡傛灉鍙戠敓鍙樺寲锛岄噸鏂拌幏鍙栧唴瀹�
+watch(
+  () => props.previewSrc,
+  () => {
+    getContent();
+  }
+);
+
+const getContent = () => {
+  content.value="";
+  fetch(props.previewSrc, {
+    responseType: "arraybuffer"
+  }).then(
+    (response) => {
+      return response.arrayBuffer();
+    }
+  ).then(
+    (data) => {
+      const decoder = new TextDecoder('gbk');
+      content.value = decoder.decode(data);
+    }
+  );
 };
-getContent(props.previewSrc);
+getContent();
 
 
 const comStyle = {

--
Gitblit v1.8.0