refactor(components): 修改 tooltip 展示内容并注释 iframe 相关代码
- 在 Tootips 组件中,将 tooltip 展示内容从 row.logic_text 改为 row.text - 在 IntelligentGeneration 组件中,注释掉 iframe 相关代码,暂时保留未删除
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user