changed scroll to top logic
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
let previousPath: string | null = null;
|
||||
|
||||
nuxtApp.hook("page:finish", () => {
|
||||
window.scrollTo(0, 0);
|
||||
const currentPath = useRoute().fullPath;
|
||||
|
||||
if (previousPath !== currentPath) {
|
||||
window.scrollTo(0, 0);
|
||||
previousPath = currentPath;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user