#fix: scroll al inicio del grid al cambiar página en el catálogo
El método scrollToTop usaba scrollIntoView en un elemento sticky, lo que no generaba desplazamiento. Ahora calcula la posición absoluta del grid de productos y hace scroll suave.
This commit is contained in:
@@ -541,15 +541,13 @@ export default {
|
||||
}
|
||||
},
|
||||
scrollToTop() {
|
||||
this.$nextTick(() => {
|
||||
const catalogHeader = this.$el?.querySelector(".page-header");
|
||||
if (catalogHeader) {
|
||||
catalogHeader.scrollIntoView({
|
||||
behavior: "smooth",
|
||||
block: "start",
|
||||
});
|
||||
const grid = this.$el?.querySelector(".product-grid");
|
||||
if (grid) {
|
||||
const top = grid.getBoundingClientRect().top + window.scrollY - 16;
|
||||
window.scrollTo({ top, behavior: "smooth" });
|
||||
} else {
|
||||
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||
}
|
||||
});
|
||||
},
|
||||
openLoginDialog() {
|
||||
this.$refs.loginDialogRef.open();
|
||||
|
||||
Reference in New Issue
Block a user