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 ? (