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}`, + }) + } } }); };