刷新回到顶部和修改样式

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: "刷新失败",
// });
// 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(

View File

@ -207,7 +207,7 @@ export default function Photos({
return hidden ? (
<div className="flex justify-center">
<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={() => {
fatherDom && fatherDom.remove();
router.push(
@ -241,7 +241,7 @@ export default function Photos({
{currentPhotos.map((item, index) => {
return (
<div
className={`relative`}
className={`relative w-max`}
// style={{ width: }}
key={index}
onClick={() => {