刷新回到顶部和修改样式

This commit is contained in:
al 2024-08-13 14:42:58 +08:00
parent 8899b66b0c
commit 44e5df6bd9
2 changed files with 12 additions and 10 deletions

View File

@ -133,6 +133,11 @@ const RecommPostList = forwardRef(({ scrollHeight }, ref) => {
// content: "刷新失败", // content: "刷新失败",
// }); // });
// throw new Error("刷新失败"); // throw new Error("刷新失败");
window.scrollTo({
top: 0,
left: 0,
behavior: "smooth", // 可选,平滑滚动效果
});
const list = await getRecommPostList(1); const list = await getRecommPostList(1);
setCommenPostList(list); setCommenPostList(list);
setHasMore(true); setHasMore(true);
@ -229,6 +234,11 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => {
// }); // });
// throw new Error("刷新失败"); // throw new Error("刷新失败");
// getRecommPostList(1); // getRecommPostList(1);
window.scrollTo({
top: 0,
left: 0,
behavior: "smooth", // 可选,平滑滚动效果
});
await getFollowPostList(ids.current, 0); await getFollowPostList(ids.current, 0);
} }
async function loadMore() { async function loadMore() {
@ -250,14 +260,6 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => {
return data; return data;
}; };
const getFollowPostList = async (data, offset) => { 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) { if (data.data.list.length > 0) {
//查关注主播展示资料 //查关注主播展示资料
const followsResponse = await requireAPI( const followsResponse = await requireAPI(

View File

@ -207,7 +207,7 @@ export default function Photos({
return hidden ? ( return hidden ? (
<div className="flex justify-center"> <div className="flex justify-center">
<div <div
className="rounded-full bg-[#131313d4] -mt-[50vh] h-max w-max px-4 py-2 text-primary" className="rounded-full text-base -mt-[50vh] h-max w-max px-6 py-3 bg-primary"
onClick={() => { onClick={() => {
fatherDom && fatherDom.remove(); fatherDom && fatherDom.remove();
router.push( router.push(
@ -241,7 +241,7 @@ export default function Photos({
{currentPhotos.map((item, index) => { {currentPhotos.map((item, index) => {
return ( return (
<div <div
className={`relative`} className={`relative w-max`}
// style={{ width: }} // style={{ width: }}
key={index} key={index}
onClick={() => { onClick={() => {