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

What are the development tools for H5 and mini program? What are the development tools for H5 and mini program?

06 Apr 2025

H5 development tools recommendations: VSCode, WebStorm, Atom, Brackets, Sublime Text; Mini Program Development Tools: WeChat Developer Tools, Alipay Mini Program Developer Tools, Baidu Smart Mini Program IDE, Toutiao Mini Program Developer Tools, Taro.

Can C   Code Be Decompiled, and How Accurate Are the Results? Can C Code Be Decompiled, and How Accurate Are the Results?

30 Nov 2024

Recovering Lost C Source Code: Exploring Decompilation OptionsLosing the source code to a C program can be frustrating, but it's not...

How Can I Configure VS Code to Build C   Programs with Multiple .cpp Files? How Can I Configure VS Code to Build C Programs with Multiple .cpp Files?

21 Dec 2024

VS Code Builds C Programs with Multiple .cpp Source FilesWhen building a C program with multiple .cpp source files in Visual Studio Code, it's...

How to adapt to 49% wide 200px high containers in mini program carousel pictures? How to adapt to 49% wide 200px high containers in mini program carousel pictures?

04 Apr 2025

Mini Program CSS Style Adaptation Problem: How to make the carousel picture adaptive container? Many developers will encounter the problem of image adaptation in mini program development. ...

Can I Decompile a Compiled Go Program? Can I Decompile a Compiled Go Program?

12 Nov 2024

Can I Decompile a Compiled Go Program?No, it is not possible to decompile a compiled Go program back into its original Go source code. Here's a...

What are the different ways of promoting H5 and mini programs? What are the different ways of promoting H5 and mini programs?

06 Apr 2025

There are differences in the promotion methods of H5 and mini programs: platform dependence: H5 depends on the browser, and mini programs rely on specific platforms (such as WeChat). User experience: The H5 experience is poor, and the mini program provides a smooth experience similar to native applications. Communication method: H5 is spread through links, and mini programs are shared or searched through the platform. H5 promotion methods: social sharing, email marketing, QR code, SEO, paid advertising. Mini program promotion methods: platform promotion, social sharing, offline promotion, ASO, cooperation with other platforms.

How to Build C   Projects with Multiple .cpp Files in VS Code? How to Build C Projects with Multiple .cpp Files in VS Code?

03 Jan 2025

VS Code Unable to Build C Program with Multiple .cpp Source FilesOne of the common challenges in using VS Code for C development is building...

First time here----smarty, first time here_PHP tutorial First time here----smarty, first time here_PHP tutorial

13 Jul 2016

New here - smarty, new here. First time here----smarty, first time here Smarty Day01-----Usage of smarty Function: Separate php html, program and art Usage: 1. Download the source code package 2. Directory structure libs source code file

Can Go Programs Be Decompiled Back to Source Code? Can Go Programs Be Decompiled Back to Source Code?

19 Nov 2024

Reverse Engineering Compiled Go ProgramsDecompiling a compiled program to its original source code is a challenging task. In the case of Go, the...

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