Skip to content

Commit

Permalink
fix: scroll bar issue
Browse files Browse the repository at this point in the history
  • Loading branch information
craigyu committed Nov 20, 2024
1 parent 0667a7e commit a644a91
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions frontend/src/assets/styles/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ label {
width: 100vw;
bottom: 0;
padding: 1.06rem 1rem 0 1rem;
overflow-y: auto;
}

.page-body {
Expand Down
17 changes: 9 additions & 8 deletions frontend/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ export const router = createRouter({
}
}),
scrollBehavior(to) {
// Check if the route has the `protectedLayoutMeta`
if (to.meta?.layout === "ProtectedLayout") {
return {
top: 0,
behavior: "smooth",
el: "#proctected-layout-container",
};
const mainElement = document.querySelector(".main");
if (mainElement) {
mainElement.scrollTo({
top: 0,
behavior: "smooth",
});
}
return false; // Prevent default Vue Router scrolling behavior
}
// Default behavior (no scrolling for other routes)
return false;
return false; // Default behavior for other routes
},
});

0 comments on commit a644a91

Please sign in to comment.