refactor: create plugin to track whether the page is fully loaded or not

This commit is contained in:
parent 1b75c199a4
commit e3d645c4dc
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

16
plugins/80.finish.ts Normal file

@ -0,0 +1,16 @@
export default defineNuxtPlugin({
name: "set finish",
setup(nuxt) {
console.log("setup start");
let loaded: Ref<boolean> = ref(false);
nuxt.hook("page:finish", (comp) => {
console.log("setup end");
loaded.value = true;
});
return {
provide: {
loaded,
},
};
},
});