primevue-mirror/middleware/route.global.js

10 lines
305 B
JavaScript
Raw Normal View History

2022-12-27 08:12:25 +00:00
export default defineNuxtRouteMiddleware((to, from) => {
useNuxtApp().hook('page:finish', () => {
if (history.state.scroll) {
setTimeout(() => window.scrollTo(history.state.scroll), 0);
} else {
setTimeout(() => window.scrollTo(0, 0), 0);
}
});
});