小程序上拉加载

1.wxml

<view class="taskdistribute">

  <view class="search" style="display:flex">

  <input  bindinput="changeCarNum" value="{{CarNum}}" placeholder="请输入车牌号,支持模糊查询"></input><button bindtap="getTaskList">查询</button>

  </view>

  <scroll-view scroll-y class="scroll-c taskList" bindscrolltolower='loadCommuteDataMore'>

      <view class="ListCon">

        <view class="con"><text>万师傅</text><text>沪A12345</text><text>1888888888</text></view><button class="changeDriver" bindtap="workDistribute" data-id='{{index}}'>指派</button> 

      </view>

      <view class="ListCon">

        <view class="con"><text>万师傅</text><text>沪A12345</text><text>1888888888</text></view><button class="changeDriver" bindtap="workDistribute" data-id='{{index}}'>指派</button> 

      </view>

  </scroll-view>

  <view style="z-index:2" class="v-placeholder" wx:if="{{commuteList.length == 0}}">搜索结果为空</view>

</view>

 

2.wxss

page{

  height: 100%;

}

.taskdistribute{

  background:#f1f1f1;

  /* padding: 20rpx; */

  font-size: 26rpx;

  display: flex;

flex-direction: column;

align-items: center;

height: 100%;

 

}

.taskList{

  display: flex;

  flex:1;

}

.taskdistribute input{

  width: 500rpx;

  border: 1px solid #ccc;

  margin-left: 10rpx;

  border-radius: 8rpx;

  background: #fff;

  padding: 3rpx 10rpx;

  height: 50rpx;

}

.taskdistribute button{

  font-size: 24rpx;

  margin:0;

  margin-left:20rpx;

  padding-left: 55rpx;

  padding-right: 55rpx;

  color: #fff;

  background: #618BDF;

}

.taskdistribute .search{

  display: flex;

  justify-content: center;

  align-items: center;

  margin-top: 20rpx;

}

.ListCon{

  margin: 20rpx;

  background: #fff;

  border-radius: 10rpx;

  padding: 20rpx 30rpx;

  position: relative;

  display: flex;

}

.ListCon .con{

  line-height: 40rpx;

  display: flex;

  width: 500rpx;

}

.ListCon .con text{

  flex: 1;

}

.taskdistribute .changeDriver{

  width:150rpx;

  padding: 0 10rpx;

  line-height: 50rpx;

  /* border-radius:4rpx ; */

  position: absolute;

  right: 30rpx;

  bottom: 15rpx;

}

 

3.js

var pageIndex = 0

var pageSize = 10

  loadCommuteDataMore: function() {

    pageIndex++;

    var that = this;

    var originSiteList = []

    wx.showLoading({

      title: '获取中',

      icon: 'none'

    })

    api.requestGet('url' , {},

      function(res) {

        wx.hideLoading()

        if (pageIndex != 0 && res.length == 0) {

          wx.showToast({

            title: '没有更多了',

            icon: 'none'

          })

          pageIndex--

          return;

        }

        originSiteList = that.data.commuteList;

        var newSiteList = originSiteList.concat(res);

        that.setData({

          commuteList: newSiteList

        })

        console.log(that.data.commuteList)

      }

  },

 

4效果图

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值