From 44e5df6bd90f44f48eba6fb7d7a6fe867c00a000 Mon Sep 17 00:00:00 2001 From: al Date: Tue, 13 Aug 2024 14:42:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=B7=E6=96=B0=E5=9B=9E=E5=88=B0=E9=A1=B6?= =?UTF-8?q?=E9=83=A8=E5=92=8C=E4=BF=AE=E6=94=B9=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/page.js | 18 ++++++++++-------- components/Photos/index.js | 4 ++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/page.js b/app/page.js index c21c924..119294e 100644 --- a/app/page.js +++ b/app/page.js @@ -133,6 +133,11 @@ const RecommPostList = forwardRef(({ scrollHeight }, ref) => { // content: "刷新失败", // }); // throw new Error("刷新失败"); + window.scrollTo({ + top: 0, + left: 0, + behavior: "smooth", // 可选,平滑滚动效果 + }); const list = await getRecommPostList(1); setCommenPostList(list); setHasMore(true); @@ -229,6 +234,11 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => { // }); // throw new Error("刷新失败"); // getRecommPostList(1); + window.scrollTo({ + top: 0, + left: 0, + behavior: "smooth", // 可选,平滑滚动效果 + }); await getFollowPostList(ids.current, 0); } async function loadMore() { @@ -250,14 +260,6 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => { return data; }; const getFollowPostList = async (data, offset) => { - console.log("ids", data); - if(!offset){ - window.scrollTo({ - top: 0, - left: 0, - behavior: "smooth", // 可选,平滑滚动效果 - }); - } if (data.data.list.length > 0) { //查关注主播展示资料 const followsResponse = await requireAPI( diff --git a/components/Photos/index.js b/components/Photos/index.js index ae68976..9e5f922 100644 --- a/components/Photos/index.js +++ b/components/Photos/index.js @@ -207,7 +207,7 @@ export default function Photos({ return hidden ? (
{ fatherDom && fatherDom.remove(); router.push( @@ -241,7 +241,7 @@ export default function Photos({ {currentPhotos.map((item, index) => { return (
{