fix scroll

This commit is contained in:
jxxghp
2023-06-29 23:12:43 +08:00
parent 523f4f1cc6
commit 175654297a
2 changed files with 9 additions and 1 deletions
+4
View File
@@ -3,6 +3,10 @@ import { createRouter, createWebHistory } from 'vue-router'
const router = createRouter({ const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL), history: createWebHistory(import.meta.env.BASE_URL),
scrollBehavior(to, from, savedPosition) {
// 始终滚动到顶部
return { top: 0 }
},
routes: [ routes: [
{ path: '/', redirect: '/dashboard' }, { path: '/', redirect: '/dashboard' },
{ {
+5 -1
View File
@@ -8,6 +8,8 @@ const props = defineProps({
apipath: String, apipath: String,
}); });
console.log(props.apipath)
// 当前页码 // 当前页码
const page = ref(1); const page = ref(1);
// 是否加载中 // 是否加载中
@@ -18,7 +20,7 @@ const dataList = ref<MediaInfo[]>([]);
const currData = ref<MediaInfo[]>([]); const currData = ref<MediaInfo[]>([]);
// 获取订阅列表数据 // 获取订阅列表数据
const fetchData = async () => { const fetchData = async ({ done }) => {
try { try {
if (!props.apipath){ if (!props.apipath){
return return
@@ -43,6 +45,7 @@ const fetchData = async () => {
} finally { } finally {
// 取消加载中 // 取消加载中
loading.value = false; loading.value = false;
done('ok')
} }
}; };
@@ -51,6 +54,7 @@ const fetchData = async () => {
<template> <template>
<VInfiniteScroll <VInfiniteScroll
mode="intersect" mode="intersect"
side="end"
:onLoad="fetchData" :onLoad="fetchData"
> >
<div class="grid gap-4 grid-media-card mx-3"> <div class="grid gap-4 grid-media-card mx-3">