微信小程序分页加载

2021/6/9 20:25:56

本文主要是介绍微信小程序分页加载,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

<view>


 

  <form catchsubmit="formSubmit" catchreset="formReset">

      <input class="weui-input" name="title" placeholder="这是一个输入框" />

        <button style="margin: 30rpx 0" type="primary" formType="submit">搜索</button>

    </form>


 

    <block wx:for="{{str}}" wx:key='key'>

    <view>

      <rich-text nodes="{{item.title}}"></rich-text>

      <text>{{item.content}}</text>

    </view>

  </block>



 

   <view class="body">

      <block wx:for="{{fang}}" wx:key="item">

        <view class="a">

          <view class="a-1"><image src="{{item.img}}"></image></view>

          <view class="a-2">

            <view>{{item.name}}</view>

            <view>{{item.desc}}</view>

          </view> 

        </view>

      </block>

</view>

</view>

 

js

  data: {

     fang:[],

     page:1,

     pagmax:6

   

  },

 

 

 

    let page=this.data.page

 

    wx.request({

      url: 'http://localhost/index.php/api/show',

      data:{page},

      success:e=>{

        // console.log(e)

         page++;

         this.setData({

          fang:e.data.data,

         

        })

        console.log(page);

      }

    })

 



这篇关于微信小程序分页加载的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程