Home Website Source Code Mini program source code Pull-up refresh and pull-up loading of WeChat applet list

Pull-up refresh and pull-up loading of WeChat applet list

##1.Introduce several components

###1.1 scroll-view component

Write picture description here

Note: When using vertical scrolling, you need to give a fixed height and set the height through WXSS. ###1.2 image component

Write picture description here

Note: mode has 12 modes, 3 of which are zoom modes and 9 are cropping modes. ###1.3 Icon component Write picture description here

iconType: [ 'success', 'info', 'warn', 'waiting', 'safe_success', 'safe_warn', 'success_circle', 'success_no_circle', 'waiting_circle', 'circle', 'download', 'info_circle' , 'cancel', 'search', 'clear' ]

2. Implementation of pull-up loading and pull-down refresh of list

##2.1 Let’s take a rendering first and write the picture description here ##2.2 The logic is very simple, just upload the code ###2.2.1 detail.wxml layout file

<loading hidden="{{hidden}}" bindchange="loadingChange">
Loading...
</loading>
<scroll-view scroll-y="true" style="height: 100%;" bindscrolltolower="loadMore" bindscrolltoupper="refesh">
<view wx:if="{{hasRefesh}}" style="display: flex;flex-direction: row;align-items: center;align-self: center;justify-content: center;">
<icon type="waiting" size="45"/><text>Refreshing...</text></view>
<view wx:else style="display:none" ><text></text></view>
<view class="llll" wx:for="{{list}}" wx:for-item="item" bindtap="bindViewTap"
         data-title="{{item.title}}" >
<image style=" width: 50px;height: 50px;margin: 20rpx;" src="{{item.firstImg}}" ></image>
<view class="eee" >
<view style="margin:5px;font-size:8px"> title:{{item.title}}</view>
        <view style="margin:5px;color:red;font-size:6px"> Source:{{item.source}}</view>
              </view>
</view>
<view class="tips1">
<view wx:if="{{hasMore}}" style="display: flex;flex-direction: row;align-items: center;align-self: center;justify-content: center;">
<icon type="waiting" size="45"/><text>Deadly loading...</text></view>
<view wx:else><text>No more content</text></view>
</view>
</scroll-view>

###2.2.1 detail.js logic code file


var network_util = require('../../utils/network_util.js');
var json_util = require('../../utils/json_util.js');
Page({
data:{
// text:"This is a page"
list:[],
dd:'',
hidden:false,
Page: 1,
Size: 20,
hasMore:true,
HasRefesh:false
},
onLoad:function(options){
var that = this;
var url = 'http://v.juhe.cn/weixin/query?key=f16af393a63364b729fd81ed9fdd4b7d&pno=1&ps=10';
Network_util._get(url,
function(res){
That.setData({
List:res.data.result.list,
        hidden: true,
});
},function(res){
console.log(res);
});
},
onReady:function(){
// Page rendering completed
},
onShow:function(){
// Page display
},
onHide:function(){
// Page hidden
},
onUnload:function(){
// Page close
},
//Click event processing
bindViewTap: function(e) {
console.log(e.currentTarget.dataset.title);
},
//Load more
loadMore: function(e) {
var that = this;
That.setData({
hasRefesh:true,});
if (!this.data.hasMore) return
var url = 'http://v.juhe.cn/weixin/query?key=f16af393a63364b729fd81ed9fdd4b7d&pno='+(++that.data.page)+'&ps=10';
Network_util._get(url,
function(res){
That.setData({
List: that.data.list.concat(res.data.result.list),
        hidden: true,
hasRefesh:false,
});
},function(res){
console.log(res);
})
},
//Refresh processing
refesh: function(e) {
var that = this;
that.setData({
hasRefesh:true,
});
var url = 'http://v.juhe.cn/weixin/query?key=f16af393a63364b729fd81ed9fdd4b7d&pno=1&ps=10';
Network_util._get(url,
function(res){
That.setData({
List:res.data.result.list,
        hidden: true,
Page:1,
hasRefesh:false,
});
},function(res){
console.log(res);
})
},
})
Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

Analysis on the implementation method of pull-down refresh and pull-up loading of WeChat applet list Analysis on the implementation method of pull-down refresh and pull-up loading of WeChat applet list

07 Dec 2017

The WeChat mini program has a special label for January 9, 2017, which quickly became popular on the Internet and in Moments. Recently, I also wrote a demo program to try it out. WeChat applet is somewhat similar to vuejs, both are data-driven views & one-way data binding, and its experience is much better than H5 page. This is due to the support of WeChat environment and the processing of loading all pages at the same time when running for the first time. This article will share the practice of pulling down to refresh and swiping up to load WeChat mini program lists.

Detailed explanation of the implementation method of pull-down refresh and pull-up loading in WeChat applet Detailed explanation of the implementation method of pull-down refresh and pull-up loading in WeChat applet

30 May 2017

There are two ways to implement pull-down refresh and pull-up loading of WeChat mini programs. 1. Use the "onPullDownRefresh" and "onReachBottom" methods to implement pull-down refresh and pull-up loading of mini programs. 2. Set bindscrolltoupper and bindscrolltolower in scroll-view to implement WeChat mini program. Pull down to refresh and pull up to load.

Implementation of pull-up loading and pull-down refresh of WeChat applet list Implementation of pull-up loading and pull-down refresh of WeChat applet list

22 Jun 2018

This article mainly introduces the method of implementing pull-up loading and pull-down refreshing of lists in WeChat applet. Has very good reference value. Let’s take a look at it with the editor below.

Implementation of pull-up loading and pull-down refresh of WeChat applet list Implementation of pull-up loading and pull-down refresh of WeChat applet list

01 Apr 2017

This article mainly introduces the method of implementing pull-up loading and pull-down refreshing of lists in WeChat applet. Has very good reference value. Let’s take a look at it with the editor below.

Detailed explanation of WeChat applet implementation of pull-down loading and pull-up refresh Detailed explanation of WeChat applet implementation of pull-down loading and pull-up refresh

14 Mar 2018

This article describes the implementation of pull-down loading and pull-up refresh by WeChat applet. If you don’t know about the implementation of pull-down loading and pull-up refresh by WeChat applet, or if you are interested in the implementation of pull-down loading and pull-up refresh by WeChat applet, then we will Get up and read this article. Okay, let’s stop talking nonsense and get to the point.

Example of WeChat applet scroll-view implementing pull-up loading and pull-down refresh Example of WeChat applet scroll-view implementing pull-up loading and pull-down refresh

23 Jun 2018

This article mainly introduces the relevant information on the example of scroll-view, a WeChat applet, that implements pull-up loading and pull-down refresh. Friends in need can refer to the following

PHP implementation of pull-down refresh and loading more functional techniques in WeChat applet PHP implementation of pull-down refresh and loading more functional techniques in WeChat applet

01 Jun 2023

With the popularity of WeChat mini programs, more and more developers are beginning to use PHP as the back-end language to implement data interaction and processing in mini programs. In the development of mini programs, pull-down refresh and loading more functions are very common requirements. Today I will introduce the techniques of using PHP to implement pull-down refresh and load more functions in WeChat mini programs. 1. Pull-down refresh Pull-down refresh is a common way of displaying list data. Users can obtain the latest data through the drop-down list. In the WeChat mini program, we can use the on provided by the mini program

Tutorial on implementing the pull-up loading and pull-down refresh effects of lists in mini program development Tutorial on implementing the pull-up loading and pull-down refresh effects of lists in mini program development

17 Aug 2017

WeChat mini program can be said to be the hottest term after September 21st. Once it appeared, it really bombarded all developers. Of course, many App developers are worried that the arrival of WeChat mini program will subvert mobile apps. As an Android developer, I don’t believe that mobile programmers will lose their jobs. Even if there is, it will take a year or two of hard work and polishing to achieve.

WeChat applet list pull-down refresh pull-up load example code WeChat applet list pull-down refresh pull-up load example code

03 Feb 2018

This article mainly shares the WeChat applet to implement pull-down refresh and pull-up loading of the list. It has certain reference value. Interested friends can refer to it. I hope it can help everyone.

See all articles See all articles

Hot Tools

WeChat mini program demo: imitation mall

WeChat mini program demo: imitation mall

WeChat mini program demo: imitating a mall, easy to get started, and has a good introduction to some basic functions of the mall

Takeaway: Implement anchor-like functionality

Takeaway: Implement anchor-like functionality

It is the similar anchor function that everyone needs. In addition, it also implements the typical ordering functions of some takeout apps. It is recommended to study and study;

WeChat mini program demo: Lezhu

WeChat mini program demo: Lezhu

WeChat mini program demo: Lezhu: similar to location-based; helpful application, somewhat similar to the spirit of Zhang Xiaolong’s mini program.

WeChat mini program game demo selects different color blocks

WeChat mini program game demo selects different color blocks

WeChat mini program game demo selects different color blocks

WeChat applet demo: carousel image transformation

WeChat applet demo: carousel image transformation

Carousel chart style change, a simple carousel chart implemented with a small program, easy to write

Hot Article

Aloft: How To Make New Clothing
17 Jan 2025 Mobile Game Guide
Aloft: Complete Resources Guide
16 Jan 2025 Mobile Game Guide
Aloft: Lost Keys, Explained
16 Jan 2025 Mobile Game Guide
Aloft: How To Use A Lost Atlas
16 Jan 2025 Mobile Game Guide