当前位置:网站首页>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 :


边栏推荐
- 2. Technology selection of Neusoft cross border e-commerce data warehouse project
- 微信小程序之计算器
- 5.1数据采集通道搭建之业务数据采集通道搭建
- 微信小程序密码显示隐藏(小眼睛)
- List and map
- 7. Data warehouse environment preparation for data warehouse construction
- [first launch in the whole network] one month later, we switched from MySQL dual master to master-slave
- [efficiency of function]
- Common methods of goframe error handling & use of error codes
- mysql的事务
猜你喜欢

What is the employment prospect of software testing? There is a large demand for talents and strong job stability

gradle自定义插件

7.数据仓库搭建之数据仓库环境准备

在 CDP中使用Iceberg 为数据湖仓增压

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

2. Technology selection of Neusoft cross border e-commerce data warehouse project

A comprehensive performance optimization, from 5 seconds to 1 second

Spark core programming (4) -- spark operation architecture

Operation of C language files

Use iceberg in CDP to pressurize the data Lake warehouse
随机推荐
JVM learning
MySQL transactions
C语言的高级操作
解决idea新建module 提示module xxxx does exitst
1. Dongsoft Cross - Border E - commerce Data Warehouse Requirement specification document
C语言动态内存管理
MYSQL基本语法字典
Minor problems of GCC compiling C language in ubantu
10 question 10 answer: do you really know thread pools?
7. Data warehouse environment preparation for data warehouse construction
特殊指针的一些应用
Macro definition of C language
replace限制文本框只能输入数字,数字和字母等的正则表达式
sql时间对比
3.东软跨境电商数仓项目架构设计
Idea import local package
编程风格
MySQL learning notes (4) - (basic crud) operate the data of tables in the database
微信小程序密码显示隐藏(小眼睛)
ambari集群扩容节点+扩容服务操作




