Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
437 views
in Technique[技术] by (71.8m points)

当处理分页数据的时候。如果条数不够的情况怎么处理呢?

我这里有个问题。分页。每页显示10条。但是目前这个接口只有9条数据。最后一条显示的是null。所以怎样避免这种报错的情况呢?

image.png
后端返回的数据:
不够的返回的null:
image.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

你这报错和分页没关系吧,是你数据处理出现了问题...
1.以实际返回的数据条数作为循环的上限
2.判断对象是否存在、是否有userId属性


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...