issue修改

This commit is contained in:
谢思 2023-01-12 13:32:02 +08:00
parent 2253b64c05
commit f2a6c90277
2 changed files with 18 additions and 2 deletions

View File

@ -70,6 +70,7 @@ class Index extends Component {
// this.getRecommandOri();
this.getList(7);
this.getAuthorList();
window.addEventListener('scroll', this.scrollListener);
}
// 获取热门开发者
@ -336,6 +337,21 @@ class Index extends Component {
)
}
componentWillUnmount() {
window.removeEventListener('scroll', this.scrollListener)
}
scrollListener = (e) => {
const clientHeight = document.documentElement.clientHeight;
const scrollHeight = document.documentElement.scrollHeight;
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
const element = document.getElementById("projectListAffix").getElementsByClassName("ant-affix")[0];
if(scrollHeight - (clientHeight + scrollTop) < 200){
element && (element.style.top = '-20px');
}else{
element && (element.style.top = '90px');
}
}
render() {
const { current_user, mygetHelmetapi} = this.props;
@ -375,7 +391,7 @@ class Index extends Component {
{bannerList && bannerList.length === 0 && <img src={banner} width="100%" alt=""/>}
{/* 项目列表 */}
<div className="ProjectListIndex exploreBox">
<Affix className="affix-list-left" offsetTop={90}>
<Affix className="affix-list-left" offsetTop={90} id="projectListAffix">
<div className="affix-list-content">
<ul className="list-l-Menu">
<li className="MenuTitle">

View File

@ -180,7 +180,7 @@ function List(props){
{
totalCount > limit &&
<div className="mb20 mt20" style={{textAlign:"center"}}>
<Pagination simple current={page} total={totalCount} onChange={(page)=>setPage(page)}/>
<Pagination simple current={page} total={totalCount} pageSize={15} onChange={(page)=>setPage(page)}/>
</div>
}
</div>}