sliderheads: [],
this.sliderheads = this.heads.slice(0, 10);
2 上拉加载10条
这里定义
limit: 10, // 每页显示行数
totalPage: 0, // 总页数
currentPage: 0, // 当前页
思路是:mui.init() 初始化
调用pullRefresh方法,
mui.init({
statusBarBackground: ‘#f7f7f7’,
pullRefresh: {
container: ‘#pullrefresh’,
up: {
contentrefresh: ‘正在加载…’,
contentnomore: ‘没有更多数据了’,
callback: app.pullupRefresh
}
}
});
pullupRefresh放在vue app的methods里面
pullupRefresh去调用methods的page方法,
在page方法里面获取当前页和每页几条,算出一共多少页,截取(slice)总数组的第二页的10条数据,拼接(concat)到当前数组后面,依次往后,上拉加载一页,就让当前页加1
app.sliderheads = app.sliderheads.concat(app.heads.slice(curLimit * page, curLimit * (page + 1)));
源码:所有涉及的导入文件均需要自行下载
普通列表
-
{{head.newsTitel}}
{{head.newsSummary}}