13 lines
323 B
TypeScript
13 lines
323 B
TypeScript
export default defineNuxtPlugin((nuxtApp) => {
|
|
let previousPath: string | null = null;
|
|
|
|
nuxtApp.hook("page:finish", () => {
|
|
const currentPath = useRoute().fullPath;
|
|
|
|
if (previousPath !== currentPath) {
|
|
window.scrollTo(0, 0);
|
|
previousPath = currentPath;
|
|
}
|
|
});
|
|
});
|