From 081dd2a172f718e13be7345db59911d28bab8bb6 Mon Sep 17 00:00:00 2001 From: LiaoYijun Date: Thu, 21 Aug 2025 15:03:29 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8fix=EF=BC=9A=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=BD=93=E9=A1=B5=E9=9D=A2=E6=9C=89=20iframe=20=E6=97=B6PageSp?= =?UTF-8?q?y=20rrweb=20=E4=BC=9A=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pageSpy/index.jsx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/pageSpy/index.jsx b/src/pageSpy/index.jsx index 0bf2433..4bf61e4 100644 --- a/src/pageSpy/index.jsx +++ b/src/pageSpy/index.jsx @@ -44,13 +44,20 @@ export const loadPageSpy = (title) => { window.$pageSpy = new PageSpy(PageSpyConfig); window.onerror = async function (msg, url, lineNo, columnNo, error) { - // 上传最近 3 分钟的日志 - const now = Date.now() - await window.$harbor.uploadPeriods({ - startTime: now - 3 * 60000, - endTime: now, - remark: `\`onerror\`自动上传. ${msg}`, - }) + + // 当页面有 iframe 时,rrweb 会报错:Cannot set property attributeName of # which has only a getter + // 而且这个错误无法修复,所以只能先忽略掉 + if (url && url.indexOf('https://page-spy.mycht.cn/plugin/rrweb/index.min.js') > -1) { + console.info('ignore rrweb error') + } else { + // 上传最近 3 分钟的日志 + const now = Date.now() + await window.$harbor.uploadPeriods({ + startTime: now - 3 * 60000, + endTime: now, + remark: `\`onerror\`自动上传. ${msg}`, + }) + } } }); };