Skip to content

Commit

Permalink
fix: Fix scrollToTop issue
Browse files Browse the repository at this point in the history
  • Loading branch information
botmaster committed Mar 4, 2024
1 parent bb072c3 commit b51b468
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pages/lab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ const { data: lastFmData, pending, error } = await useFetch(`https://ws.audioscr
});
return data.recenttracks;
},
onResponse() {
scrollListToTop();
},
});
// Computed data
Expand Down Expand Up @@ -72,13 +75,12 @@ const {
pageSize,
onPageChange(returnValue) {
page.value = returnValue.currentPage;
scrollListToTop();
},
});
// Scroll to top of the list when page changes
function scrollListToTop() {
const listElement = playlistListRef.value as HTMLElement;
const listElement = playlistListRef.value;
if (listElement) {
listElement.scrollTo({
top: 0,
Expand Down

0 comments on commit b51b468

Please sign in to comment.