收藏
回答

增加了触底加载数据,但是页面还是显示20条数,怎么回事?

 <view class="table_headerwx:for="{{ hisrecord }}wx:key="index">

 <view class="tdstyle='width:150rpx;background-color:white; color:black'>{{item.title}}</view>

        <view class="td">{{item.allnum}}</view>

  <view class="td">{{item.lastnum}}</view>

 <view class="td"  wx:if="{{item.addyn=='Y'}}"></view>

          <view class="td"  wx:if="{{item.addyn=='N'}}"></view>

    </view>

===================================================

hisrecord:this.data.hisrecord.concat(res.data)

如果改成这样拼接数据,但也只是不断显示前20条数据,想要显示所有数据应该怎么弄呢?

pageData:{skip:0},

  getshow:function(callback){

    if(!callback)

    {

      callback=res=>{}

    }

  

    db.collection("kinds").skip(this.pageData.skip).where({useyn:'Y'}).get().then(res => {


      this.setData({

       //hisrecord:this.data.hisrecord.concat(res.data)

      hisrecord:res.data

      }),res=>{

     

        this.pageData.skip=this.pageData.skip+20

        callback()

      }

      

      

    })

  },

  onPullDownRefresh:function()

   {

     this.getshow(res=>{

       wx.stopPullDownRefresh();

       this.pageData.skip=0;

      

      });

     

   },

    onReachBottom:function()

    {

      

      this.getshow();

      console.log('ssf')

    },


回答关注问题邀请回答
收藏
登录 后发表内容