diff --git a/src/router/index.ts b/src/router/index.ts index 834dbd98..f3cfaf9d 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -3,6 +3,10 @@ import { createRouter, createWebHistory } from 'vue-router' const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), + scrollBehavior(to, from, savedPosition) { + // 始终滚动到顶部 + return { top: 0 } + }, routes: [ { path: '/', redirect: '/dashboard' }, { diff --git a/src/views/discover/MediaCardListView.vue b/src/views/discover/MediaCardListView.vue index fb566b58..b9580662 100644 --- a/src/views/discover/MediaCardListView.vue +++ b/src/views/discover/MediaCardListView.vue @@ -8,6 +8,8 @@ const props = defineProps({ apipath: String, }); +console.log(props.apipath) + // 当前页码 const page = ref(1); // 是否加载中 @@ -18,7 +20,7 @@ const dataList = ref([]); const currData = ref([]); // 获取订阅列表数据 -const fetchData = async () => { +const fetchData = async ({ done }) => { try { if (!props.apipath){ return @@ -43,6 +45,7 @@ const fetchData = async () => { } finally { // 取消加载中 loading.value = false; + done('ok') } }; @@ -51,6 +54,7 @@ const fetchData = async () => {