当前位置:网站首页>Wechat applet_ 8. View and logic
Wechat applet_ 8. View and logic
2022-06-28 19:33:00 【icestone_ kai】
The goal is :
- Can know how to realize the navigation jump between pages
- Can know how to achieve the pull-down refresh effect
- You can know how to pull up and load more effects
- Be able to know the life cycle functions commonly used in small programs
Logic and view
What is page navigation :
Page navigation refers to the jump between pages , for example : There are two ways to realize page navigation in the browser
1. link
2.location.href
There are two ways to realize page navigation in applet :
1. Declarative navigation :
- Declare a... On the page
<navigatoe>Navigation components - By clicking on
<navigator>Component to realize page Jump
2. Programming navigation :
- Calling applet navigation API, Realize page Jump
Navigate to tabBar page :
tabBar A page refers to a page that is configured to tabBar The page of
In the use of <navigator> The component jumps to the specified tabBar When the page is , You need to specify the url Properties and open-type attribute , among :
- url Indicates the page address to jump to , Must be
/start - open-type Indicates how to jump , Must be switchTab
The example code is as follows :
<navigator url="/pages/message/message" open-type="switchTab"> Navigate to message Loop page </navigator>
- Be careful , here tabBar The configured page needs to be displayed in
app.jsonMediumtabBarThe page configured under the node will jump !
Navigate to non tabBar page :
Through non declarative navigation
Not tabBar A page is one that is not configured to tabBar The page of
In the use of <navigator> Component jump to non tabBar When the page is , You need to specify url Properties and open-type attribute , among :
- url Indicates the page address to jump to , Must be / start
- open-type Indicates how to jump , It has to be for
navigator
The example code is as follows :
<navigator url="/pages/for/for" open-type="navigate"> Navigate to for Loop page </navigator>
there url Attributes only need to be in app.json Of pages The node can be configured
Be careful : For simplicity , Navigate to non tabBar When the page is ,open-type="navigate" Properties can be omitted
Back navigation :
If you want to go back to the previous page or multi-level page , You need to specify open-type and delta attribute , among :
- open-type The value of must be navigateBack, Indicates that you want to perform back navigation
- delta The value of must be a number , Indicates that you want to navigate backwards
The sample code is as follows :
<navigator open-type="navigateBack" delta="-1">
Return to upper level
</navigator>
边栏推荐
- 华为云OneMeeting告诉你全场景会议这么开!
- 使用点云构建不规则三角网TIN
- Rigid error: could not extract PIDs from PS output PIDS: [], Procs: [“bad pid
- mysql全解 Ubuntu/win10
- 小白创业做电商,选对商城系统很重要!
- C language - function knowledge points
- H5 sunflower operation
- 我是刚购买的adb mysql服务,我每做一个操作,比如建表,都会弹出这个问题,请问这是什么问题?
- [C #] explain the difference between value type and reference type
- echart:横向柱状图的类目文字位置调整
猜你喜欢

Parallax JS special effect JS carousel map plug-in

How to change the status bar at the bottom of win11 to black? How to change the status bar at the bottom of win11 to black

智能计算系统1 环境搭建

Question brushing analysis tool

Fontawesome icon for color gradient

PCL 环境下安装配置CGAL 5.4.1

从设计交付到开发,轻松畅快高效率!

Ffmpeg usage in video compression processing

pd.cut 区间参数设定之前后区别

How does win11 slim down the system disk? Slimming method of win11 system disk
随机推荐
视频压缩处理之ffmpeg用法
Chunfeng power and Huawei work together to build a smart Park benchmark, and the future factory innovation will reach a new level
华为云OneMeeting告诉你全场景会议这么开!
C language file operation
try except 添加辅助新列
i人事HR系统上架企业微信ISV,增强企微在服务连锁零售等行业深度应用
Figure introduction to neural networks (GNN, GCN)
SQL calculates daily new users and retention rate indicators
rancher增加/删除node节点
Win11底部状态栏如何换成黑色?Win11底部状态栏换黑色的方法
Gaozelong, a digital economy expert: Yingke changed its name to yingcosmos. Will yuancosmos become the next growth engine of Yingke?
return new int[]{i + 1, mid + 1};return {i + 1, mid + 1};
G 双轴图sql脚本
How many objects are created after new string ("hello")?
kettle(六):基于Kettle的数据库全量备份
From design delivery to development, it is easy and efficient!
直播app系统源码,动态遇到视频时开始自动播放
Windows 64位下载安装My SQL
H5 sunflower operation
Paper notes: universal value function approvers