From ae57f28357623b4787abb67a498d3b80793ebca5 Mon Sep 17 00:00:00 2001 From: wangqiao Date: Thu, 16 Oct 2025 22:40:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8E=92=E8=A1=8C=E6=A6=9C?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=B9=B6=E6=B7=BB=E5=8A=A0=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/home/components/Leaderboard.vue | 2 +- plugins/error-handler.ts | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 plugins/error-handler.ts diff --git a/pages/home/components/Leaderboard.vue b/pages/home/components/Leaderboard.vue index d11d6da..7245f02 100644 --- a/pages/home/components/Leaderboard.vue +++ b/pages/home/components/Leaderboard.vue @@ -79,7 +79,7 @@
{{ dayjs(item.createTime).format('MM-DD') }}
- + diff --git a/plugins/error-handler.ts b/plugins/error-handler.ts new file mode 100644 index 0000000..5b8f5a7 --- /dev/null +++ b/plugins/error-handler.ts @@ -0,0 +1,11 @@ +export default defineNuxtPlugin((nuxtApp) => { + nuxtApp.vueApp.config.errorHandler = (error, instance, info) => { + // 处理错误,例如发送报告到服务 + console.log(error) + } + + // 也可以这样做 + // nuxtApp.hook('vue:error', (error, instance, info) => { + // // 处理错误,例如发送报告到服务 + // }) +})