1.UI的实现效果

2.js业务逻辑部分
import prompt from '@system.prompt';
export default {
data: {
title: 'World',
listdatas:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,
21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],
currentnum:1,
fixednum:5,
pagelists:[],
text:"加载更多",
flag:false
},
onInit()
{
this.showData(this.currentnum);
},
loaddata()
{
++this.currentnum;
this.showData(this.currentnum);
},
showData(curnum)
{
let pageSize=this.listdatas.length%this.fixednum==0?
this.listdatas.length/this.fixednum:Math.floor(this.listdatas.length/this.fixednum)+1;
if(curnum>pageSize)
{
prompt.showToast({
message:"用户您好,数据已经到底了",
duration:4000
})
this.text="哥或妹,你好,我已经到底了";
this.flag=true;
}
else
{
this.pagelists=this.listdatas.slice(0,curnum*this.fixednum);
}
}
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
3.页面布局
4.样式部分
5.最终效果

最好能把源代码打个包作为附件^_^