当前位置:网站首页>Page navigation of wechat applet
Page navigation of wechat applet
2022-07-19 05:38:00 【One finger quicksand Q】
Catalog
One 、 Page navigation
There are two ways to realize page navigation : Declarative navigation and programmatic navigation
Declarative navigation :
- Declare a... On the page <navigator> Navigation components
- By clicking on <navigator> Component to realize page Jump
Programming navigation :
- Calling applet navigation API, Realize page Jump
contrast :
| type | Navigate to tabBar page | Navigate to non tabBar page | Back navigation |
| Declarative navigation | url: Must be / start open-type="switchTab" | url: Must be / start open-type="navigate"( Omission ) | open-type The value must be navigateBack delta It has to be numbers , Indicates the level of retreat ( The default is 1) Cannot back to tabBar |
| Programming navigation |
url The path cannot be followed by parameters |
url The path can be followed by parameters |
Can go back to tabBar |
Navigation parameters
| type | chart | explain |
| Declarative navigation | ![]() |
|
| Programming navigation | ![]() | call wx.navigateTo(Object object) Method to jump to the page , You can also carry parameters |
Two 、 Page Events
① Drop down refresh event : Reload page data
1. On page .json In profile
- take enablePullDownRefresh Set to true
- backgroundColor Used to configure the background color of the drop-down refresh window , Support only 16 The color value of base
- backgroundTextStyle Used to configure pull-down refresh loading The style of , Support only dark and light
| Property name | type | The default value is | explain |
backgroundColor | HexColor | #ffffff | Background color of window |
backgroundTextStyle | String | dark | The drop-down loading The style of , Support only dark / light |
enablePullDownRefresh | Boolean | false | Enable pull-down refresh globally |
2. On page .js In file , Set manually hidden drop-down refresh loading effect
adopt onPullDownRefresh() Function to listen to the pull-down refresh event of the current page .
here , call wx.stopPullDownRefresh() You can stop the pull-down refresh of the current page . The sample code is as follows :

② Pull up bottoming Events : Load more data
1. On page .js In file
adopt onReachBottom() Function to listen to the pull-up bottom event of the current page . The sample code is as follows :

2. On page .json In profile , Configure the pull-up bottom touch distance
adopt onReachBottomDistance Property to configure the distance of pulling up to the bottom .
The default bottom distance is 50px
| attribute | type | The default value is | explain |
| onReachBottomDistance | Number | 50 | Distance from the bottom of the page when the pull-up event is triggered , Unit is px |
3、 ... and 、WXS Script
wxml Cannot call in the page .js The function defined in , however ,wxml Can be called wxs The function defined in . therefore , Small program wxs A typical application scenario is “ filter ”.
① Embedded wxs Script
wxml Every... In the document <wxs></wxs> label , You must provide module attribute , Used to specify the current wxs Module name of , Convenient in wxml Access the members in the module :

② Extraneous wxs Script
stay wxml Introduce outreach in wxs Script time , It has to be for <wxs> add module and src attribute , among : module Used to specify the name of the module src Used to specify the path of the script to be imported , And it has to be a relative path The sample code is as follows :
wxs The code can also be written in .wxs The suffix for the file inside , It's like javascript The code can be written in .js It is the same as in the file with suffix name . The sample code is as follows :


边栏推荐
- The future of data Lakehouse - Open
- LiveData浅析
- C语言&位域
- 5.数据采集通道搭建之业务分析
- A comprehensive performance optimization, from 5 seconds to 1 second
- Data Lakehouse的未来-开放
- 二叉树的先序、中序、后序遍历
- 10. DWD layer construction of data warehouse construction
- 5. Business analysis of data acquisition channel construction
- MySQL learning notes (4) - (basic crud) operate the data of tables in the database
猜你喜欢

MySQL installation and configuration tutorial (super detailed)

微信小程序的页面导航

解决idea新建module 提示module xxxx does exitst

10问10答:你真的了解线程池吗?

ubantu中gcc编译C语言小问题

Use of MySQL

11.数据仓库搭建之DWS层搭建

The latest news of spring recruitment in 2022: the average salary of it Internet industry is 18500 yuan

5.1数据采集通道搭建之业务数据采集通道搭建

配置tabBar和request网络数据请求
随机推荐
12. Ads layer construction of data warehouse construction
利用IDE打jar包
4. Neusoft cross border e-commerce data warehouse project - user behavior data acquisition channel construction of data acquisition channel construction (2022.6.1-2022.6.4)
Talk about the 8 pits of redis distributed lock
8. ODS layer construction of data warehouse
typedef
1.东软跨境电商数仓需求规格说明文档
MySQL queries the data of the current day, this week, this month and last month
对象转map
MYSQL基本语法字典
跨域和处理跨域
Pointer array & array pointer
MySQL学习笔记(5)——JOIN联表查询,自连接查询,分页和排序,子查询与嵌套查询
D3.V3.js数据可视化 -- 力导向图之图片和提示
5.1数据采集通道搭建之业务数据采集通道搭建
Common (Consortium)
【全网首发】主线程异常会导致 JVM 退出?
Is the software testing training of lemon class reliable? This successful case of counter attack from the training class tells you
Table field attribute query
mysql的事务



