next/plugins/80.finish.ts

25 lines
516 B
TypeScript

export default defineNuxtPlugin({
name: "set finish",
setup(nuxt) {
console.log("setup start");
let loaded: Ref<boolean> = ref(false);
nuxt.hook("app:beforeMount", (app) => {
loaded.value = false;
});
nuxt.hook("page:start", (comp) => {
loaded.value = false;
// comp.$nuxt.$loaded = loaded;
});
nuxt.hook("app:mounted", (comp) => {
console.log("setup end");
loaded.value;
comp.$nuxt.$loaded.value = loaded.value = true;
});
return {
provide: {
loaded,
},
};
},
});