From e3d645c4dcef58c8013178dd104ee4f7ac5b6ac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Wed, 11 Oct 2023 16:54:32 -0400 Subject: [PATCH] refactor: create plugin to track whether the page is fully loaded or not --- plugins/80.finish.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 plugins/80.finish.ts diff --git a/plugins/80.finish.ts b/plugins/80.finish.ts new file mode 100644 index 0000000..4e543ef --- /dev/null +++ b/plugins/80.finish.ts @@ -0,0 +1,16 @@ +export default defineNuxtPlugin({ + name: "set finish", + setup(nuxt) { + console.log("setup start"); + let loaded: Ref = ref(false); + nuxt.hook("page:finish", (comp) => { + console.log("setup end"); + loaded.value = true; + }); + return { + provide: { + loaded, + }, + }; + }, +});