Detailed explanation of how scroll-view completes list pages
Y2J
Release: 2018-05-14 09:12:54
Original
3025 people have browsed it
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:
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:
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
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!
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!
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn