微信小程序分页加载
作者:互联网
<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);
}
})
标签:分页,fang,微信,item,key,wx,data,page,加载 来源: https://blog.csdn.net/zcbzcb52/article/details/117751952