wxml:

<scroll-view class='swiper-scroll' scroll-y="{{true}}" bindscrolltolower="lower" style='height:800rpx;'>
<block wx:for="{{requestRes}}" wx:key="item" wx:for-index="idx">
<view>
<image style='width:100rpx;height:100rpx;' src="{{requestRes[idx].avatar}}" alt=""></image>
</view>
<view>{{requestRes[idx].description}}</view>
<view><text>¥<text>{{item.price}}</text></text><text>¥{{item.oldprice}}</text></view>
</block>
<view class="tips1">
<view wx:if="{{hasMore}}">
<text>玩命的加载中...</text>
</view>
<view wx:else>
<text>没有更多内容了</text>
</view>
</view>
</scroll-view>
 
js:
 
//index.js
//获取应用实例
var app = getApp()
var http = app.globalData.http
Page({
data: {
requestRes: {},
pagel: 1, // 发出的 页数
hasMore: false
},
// 触底加载数据
lower: function (e) {
console.log('kaihsi')
this.setData({
hasMore: true
})
this.loaddatal();
},
onLoad: function (option) {
var that = this
// 请求数据
wx.request({
url: 'http://cloud.topmdrt.com/api/v1/activity/goods_praise/page',
method: 'get',
data: {
currentPage: this.data.pagel,
sourceId: 2,
id: 83
},
success: function (res) {
console.log(res)
that.setData({
requestRes: res.data.response.dataList
})
}
})
},
// 发出的数据 加载
loaddatal: function () {
console.log('chufa')
var listData = this.data.requestRes;
var that = this;
var pag = this.data.pagel + 1;
wx.request({
url: 'http://cloud.topmdrt.com/api/v1/activity/goods_praise/page',
method: 'get',
data: {
currentPage: pag,
sourceId: 2,
id: 83
},
success: function (res) {
var pagel = that.data.pagel + 1;
if (res.data.response.dataList.length == 0) {
this.setData({
requestRes: res.data.response.dataList,
pagel: -1
})
return false;
}
that.setData({
pagel: pagel,
requestRes: listData.concat(res.data.response.dataList),
hasMore: false
})
// that.update()
}
})
}
})
 
wxss:

/**上拉加载更多**/
.tips1{
height: 60rpx;
line-height: 60rpx;
color: #999;
font-size: 21rpx;
text-align: center;
}
/* */
.minearea image {
text-align: center;
display: block;
}
.minearea {
text-align: center;
line-height: 3.2rem;
}
.page-section {
width: 76%;
margin: auto;
margin-top: 36rpx;
}
.weui-input {
border: solid 1px #e6e6e6;
height: 90rpx;
border-radius: 2rpx;
padding-left: 20rpx;
padding-right: 20rpx;
">#f5f5f5;
color: #333;
}
.page-body {
margin-top: 120rpx;
}
.page-section-title {
color: #333;
font-size: 32rpx;
padding-left: 0rpx;
}
.placeholder {
color: #cbcbcb;
}
.btn-area {
margin-top: 90rpx;
}
 
 
 
 
 
 
 
 
 
 

最新文章

  1. C语言之Sleep函数
  2. git ssh key for github
  3. 静态long类型常量serialVersionUID的作用
  4. JavaScript对象属性 constructor
  5. delphi删除只读文件
  6. 如何用Postman组装Request并且查看Response
  7. 内网穿透+VS2015自带IIS express实现本地调试(微信等需要将开发环境暴漏到外网的情况使用)
  8. 【Egret】2D 使用中的一些疑难解决技巧!
  9. .Netcore之日志组件Log4net、Nlog性能比较
  10. C# .NET 0配置使用Wcf(半成品)
  11. Eclipse+Maven环境下java.lang.OutOfMemoryError: PermGen space及其解决方法
  12. Python(三)——文件操作
  13. eclipse安装阿里编码规约插件
  14. bzoj4337树的同构
  15. Java对象之间的深度复制拷贝
  16. Oracle 通过触发器实现ID自增
  17. Elasticsearch的停用词(stopwords)
  18. LaTeX公式
  19. [转] Ansible 内置变量参考
  20. 如何让每个 WordPress 页面有不同的风格或者样式

热门文章

  1. metasploit出错信息:can&#39;t allocate memory
  2. 【hdu4010】 Query on The Trees
  3. 2019PKU\THU WC题解
  4. 【最小割/二分图最大独立集】【网络流24题】【P2774】 方格取数问题
  5. 语法:c++对关于空指针0/NULL/nullptr三者的演变
  6. .Net并行编程系列之三:创建带时间限制(Timeout)的异步任务并取得异步任务的结果
  7. ActiveMQ基本详解与总结&amp; 消息队列-推/拉模式学习 &amp; ActiveMQ及JMS学习
  8. 第八届蓝桥杯c/c++省赛题目整理
  9. Redis学习八:Redis的事务
  10. 【mybatis笔记】 resultType与resultMap的区别