This article mainly introduces the relevant information on the example code of the scroll-view component of the WeChat applet to implement the list page. Introduction to the scroll-view component scroll-view is a scrollable view component provided by the WeChat applet. Its main function is to use To do the pull-up loading that is often seen on mobile phones, friends who need it can refer to the introduction of
scroll-view component
scroll-view is provided by WeChat applet The scrollable view component, its main function is to do the pull-up to load and pull-down to refresh the list page that is often seen on mobile phones! Let's take "Shake out a smile" as an example to explain the component. Use !
Import a new page for the app
First we need to import a new page for our mini program and open the app in the project root directory.json This projectConfiguration fileIn the pagesarrayAdd "pages/allJoke/allJoke" and then set the bottom NavigationIn the list item of "tabBar" ("list") Add:
{ "text": "列表", "pagePath": "pages/allJoke/allJoke", "iconPath": "images/note.png", "selectedIconPath": "images/noteHL.png" },
If you want to know the meaning of the specific configuration, you can refer to the Mini Program Configuration document and I won’t go into details here!
json configuration page
The next step is the configuration page for our new page. Create a new directory such as alljoke under the page directory, then create a new allJoke.json under this directory, and copy the following code to this file. Inside:
{ "navigationBarTitleText": "笑话集锦", "enablePullDownRefresh": true }
Because we need to use the onPullDownRefresh method provided by the applet when doing pull-down refresh later, enablePullDownRefresh must be turned on in the configuration item. The other option is the top title of the page, which you can set at will or not. !
wxml view page
It’s the turn of the view page. Similarly, create a new alljoke.wxml page in the alljoke directory. wxml is the one created by the mini program The view page document type is written like HTML, so it is not difficult for the front-end to get started. If you need to know more about it, you can read the wxml document. Also copy the following code to alljoke.wxml
<view> <view> <scroll-view class="scroll" scroll-top="{{scrollTop}}" style="height:580px;" scroll-y="true" bindscroll="scrll" bindscrolltolower="loadMore"> <view class="block" wx:for="{{listLi}}" wx:for-item="item"> <text>{{item.text}}</text> </view> </scroll-view> </view> <view class="top" hidden="{{hidden}}" catchtap="goTop">⇧</view> </view>
As you can see, we The protagonist scroll-view also makes a grand appearance here! What I brought here is a long list of configurations, let me tell you about the functions of these configurations!
Configuration item | Function |
---|---|
scroll-top | Set the position of the vertical scroll bar. Please pay attention to if it is set The value does not change and the component will not render! |
scroll-y | Allow vertical scrolling |
Callback function triggered when scrolling | ##bindscrolltolower |
Event triggered when scrolling to the bottom |
The above is the detailed content of Detailed explanation of how scroll-view completes list pages. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
