From dc6475c54ce3677654c76c8f2a442214794fbfcd Mon Sep 17 00:00:00 2001 From: linju Date: Thu, 14 Nov 2024 14:35:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E7=9B=91=E5=90=AC=E9=94=99=E8=AF=AF=E5=B9=B6=E4=B8=8A=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/init/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sdk/init/index.js b/sdk/init/index.js index 4a87fe8..f2958a7 100644 --- a/sdk/init/index.js +++ b/sdk/init/index.js @@ -61,6 +61,12 @@ export default async function (initParam) { }); } + // 监听所有错误并上报 + window.addEventListener('error', function(e) { + console.error('监听所有错误并准备上报 error', e) + $utils.reportError(e.error) + }); + $state.networkConnected = navigator.onLine; window.addEventListener('online', function() { $state.networkConnected = true; -- GitLab