refactor(components): 修改 tooltip 展示内容并注释 iframe 相关代码

- 在 Tootips 组件中,将 tooltip 展示内容从 row.logic_text 改为 row.text
- 在 IntelligentGeneration 组件中,注释掉 iframe 相关代码,暂时保留未删除
This commit is contained in:
Huangzhe
2025-05-27 10:48:03 +08:00
parent 1cf2ad8155
commit 2b297d5e80
2 changed files with 39 additions and 39 deletions

View File

@@ -4,7 +4,7 @@ const content = defineModel<{ row: any; column: any; cellValue: any }>('content'
<template>
<div class="tooltip-content">
<span v-html="content?.row?.logic_text"></span>
<span v-html="content?.row?.text"></span>
</div>
</template>

View File

@@ -7,47 +7,47 @@ const param = `token=${encodeURIComponent(localStorage.getItem('plantToken') as
// const url = host + path + param;
const url = host + path + param;
const iframe = ref<HTMLIFrameElement | null>(null);
// const iframe = ref<HTMLIFrameElement | null>(null);
onMounted(() => {
// 保存原始的window.open方法
const originalOpen = window.open;
// onMounted(() => {
// // 保存原始的window.open方法
// const originalOpen = window.open;
// 监听iframe的load事件确保iframe已完全加载
iframe.value?.addEventListener('load', () => {
try {
const iframeWindow = iframe.value?.contentWindow;
// // 监听iframe的load事件确保iframe已完全加载
// iframe.value?.addEventListener('load', () => {
// try {
// const iframeWindow = iframe.value?.contentWindow;
// 尝试覆盖iframe的open方法
if (iframeWindow) {
// 方法一:直接覆盖
try {
iframeWindow.open = function (...args: any[]) {
// console.log('iframe中的open方法被调用参数', args);
// 使用父窗口的open方法打开
return originalOpen.apply(window, args as any);
};
} catch (e) {
// 方法二如果直接覆盖失败尝试使用defineProperty
try {
Object.defineProperty(iframeWindow, 'open', {
value: function (...args: any[]) {
// console.log('iframe中的open方法被调用参数', args);
return originalOpen.apply(window, args as any);
},
writable: true,
configurable: true
});
} catch (e2) {
// console.error('无法覆盖iframe的open方法(defineProperty)', e2);
}
}
}
} catch (error) {
console.error('无法覆盖iframe的open方法', error);
}
});
});
// // 尝试覆盖iframe的open方法
// if (iframeWindow) {
// // 方法一:直接覆盖
// try {
// iframeWindow.open = function (...args: any[]) {
// // console.log('iframe中的open方法被调用参数', args);
// // 使用父窗口的open方法打开
// return originalOpen.apply(window, args as any);
// };
// } catch (e) {
// // 方法二如果直接覆盖失败尝试使用defineProperty
// try {
// Object.defineProperty(iframeWindow, 'open', {
// value: function (...args: any[]) {
// // console.log('iframe中的open方法被调用参数', args);
// return originalOpen.apply(window, args as any);
// },
// writable: true,
// configurable: true
// });
// } catch (e2) {
// // console.error('无法覆盖iframe的open方法(defineProperty)', e2);
// }
// }
// }
// } catch (error) {
// console.error('无法覆盖iframe的open方法', error);
// }
// });
// });
</script>
<template>