|
|
@@ -56,31 +56,9 @@
|
|
|
window.open(this.fileUrl);
|
|
|
|
|
|
var iframe = document.getElementById('Iframe');
|
|
|
- if (!iframe) {
|
|
|
- throw new Error('无法获取iframe文档,可能存在跨域限制');
|
|
|
- }
|
|
|
-
|
|
|
- const className = this.targetClass.trim();
|
|
|
- // 查找指定class的元素
|
|
|
- const elements = iframe.getElementsByClassName(className);
|
|
|
-
|
|
|
- if (!elements || elements.length === 0) {
|
|
|
- throw new Error(`未找到class为 "${className}" 的元素`);
|
|
|
- }
|
|
|
-
|
|
|
- // 获取第一个匹配的元素
|
|
|
- const targetElement = elements[0];
|
|
|
-
|
|
|
- // 克隆元素以避免影响原页面
|
|
|
- const clonedElement = targetElement.cloneNode(true);
|
|
|
-
|
|
|
- // 获取元素的HTML内容
|
|
|
- const htmlContent = clonedElement.outerHTML;
|
|
|
- this.extractedRawHtml = htmlContent;
|
|
|
- this.extractedContent = htmlContent;
|
|
|
-
|
|
|
- this.extractSuccess = `成功提取到 ${elements.length} 个元素(显示第一个)`;
|
|
|
- this.showMessage(this.extractSuccess, 'success');
|
|
|
+ var iframeDocument = iframe.contentWindow.document;
|
|
|
+ var container = iframeDocument.querySelectorAll('.container');
|
|
|
+ this.$refs.aa.init(container[0].innerHTML);
|
|
|
},
|
|
|
setFileUrl(row) {
|
|
|
this.loading = true;
|