From dfb7a8a63e87390dc095e81b04f0404697246d9f Mon Sep 17 00:00:00 2001
From: 张涛 <“2538313560@qq.com”>
Date: 星期五, 22 十一月 2024 20:20:56 +0800
Subject: [PATCH] 增加跳转的接口
---
src/views/dmx/knowledgeLib/components/txt.vue | 37 ++++++++++++++++++++++++++-----------
1 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/src/views/dmx/knowledgeLib/components/txt.vue b/src/views/dmx/knowledgeLib/components/txt.vue
index 6cd3f41..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,17 +18,31 @@
}
});
-const getContent = (url) => {
- fetch(url)
- .then((res) => res.text())
- .then((data) => {
- content.value = data;
- });
-};
-getContent(props.previewSrc);
+//鐩戞帶灞炴�reviewSrc鐨勫彉鍖栵紝濡傛灉鍙戠敓鍙樺寲锛岄噸鏂拌幏鍙栧唴瀹�
+watch(
+ () => props.previewSrc,
+ () => {
+ getContent();
+ }
+);
-//寮曞叆VueOfficeExcel缁勪欢鐩稿叧
-import "@vue-office/excel/lib/index.css";
+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();
+
const comStyle = {
width: "100%",
--
Gitblit v1.8.0