优化模板中心模板查询懒加载,小屏幕显示有数据未加载bug

This commit is contained in:
许红梅 2022-05-18 17:39:30 +08:00
parent a8148054b5
commit e6afbc6cb3
2 changed files with 5 additions and 4 deletions

View File

@ -17,10 +17,9 @@
width: 100%; width: 100%;
line-height: 40px; line-height: 40px;
&:hover{ &:hover{
background: #f00; background: #f6f7f8;
color: #296bef; color: #296bef;
} }
} }
.mouse_menuactive{ .mouse_menuactive{
font-weight: bold; font-weight: bold;

View File

@ -109,7 +109,9 @@ export default class mytemplate extends React.Component {
this.setState({ toTopFlag: true }); this.setState({ toTopFlag: true });
this.setState({ toTopshow: false }); this.setState({ toTopshow: false });
let isBottom = event.target.scrollHeight - event.target.clientHeight; let isBottom = event.target.scrollHeight - event.target.clientHeight;
if (Math.round(isBottom) == Math.round(event.target.scrollTop)) { console.log('到底了',Math.round(isBottom));
console.log('设备高度',Math.round(event.target.scrollTop));
if (Math.round(isBottom)+1 == Math.round(event.target.scrollTop)) {
let endreq = this.state.endreq; let endreq = this.state.endreq;
if (endreq) { if (endreq) {
let page = this.state.page;//请求 let page = this.state.page;//请求
@ -122,7 +124,7 @@ export default class mytemplate extends React.Component {
let preResult = this.state.system_template; let preResult = this.state.system_template;
getSystemTemplate(data).then(res => { getSystemTemplate(data).then(res => {
handelResponse(res, (req, msg) => { handelResponse(res, (req, msg) => {
if (req.data.length > 0) { if (0<req.data.length&&req.data.length==10) {
let addres = preResult.concat(req.data) let addres = preResult.concat(req.data)
this.setState({ system_template: addres, page: page }) this.setState({ system_template: addres, page: page })
} else { } else {