attempt to fix scroll behavior

This commit is contained in:
Hayden 2023-01-01 12:46:59 -09:00
parent 59ebf0af73
commit 7c240a563b
No known key found for this signature in database
GPG key ID: 17CF79474E257545
5 changed files with 7 additions and 18 deletions

View file

@ -1,14 +0,0 @@
import type { RouterConfig } from "@nuxt/schema";
export default <RouterConfig>{
scrollBehavior(to, from, savedPosition) {
console.log(to, from, savedPosition);
if (savedPosition) {
return savedPosition;
} else {
return {
top: 0,
};
}
},
};

View file

@ -56,7 +56,6 @@
const calcWidth = ref(0);
function resize() {
console.log("resize", el.value?.offsetHeight, el.value?.offsetWidth);
calcHeight.value = el.value?.offsetHeight || 0;
calcWidth.value = el.value?.offsetWidth || 0;
}

View file

@ -13,5 +13,4 @@ export default defineNuxtConfig({
},
},
css: ["@/assets/css/main.css"],
plugins: [],
});

View file

@ -39,8 +39,6 @@
const hasNext = computed(() => page.value * pageSize.value < total.value);
const hasPrev = computed(() => page.value > 1);
const itemsTitle = ref<HTMLDivElement>();
function prev() {
page.value = Math.max(1, page.value - 1);
}

View file

@ -0,0 +1,7 @@
export default defineNuxtPlugin(nuxtApp => {
nuxtApp.hook("page:finish", () => {
console.log(document.body);
document.body.scrollTo({ top: 0 });
console.log("page:finish");
});
});