当前位置:网站首页>Using tabbar in wechat applet
Using tabbar in wechat applet
2022-07-02 01:20:00 【richest_ qi】
List of articles
Prospect knowledge
front We learned : stay app.json To configure the applet globally ,app.json The content of the file is a JSON object , There are many properties , One of the common attributes is tabBar. If the applet is more than one tab application , You can go through tabBar Appoint tab Column performance , as well as tab The corresponding page displayed when switching .
tabBar The attribute value of is also an object , This object contains the following common properties :
color,tab The default color of the text on , Only hex colors... Are supported , Required .selectedColor,tab The color when the upper text is selected , Only hex colors... Are supported , Required .backgroundColor,tab Background color , Only hex colors... Are supported , Required .position,tabBar The location of , Only two values are supported :bottomandtop, The default value isbottom.list,tab A list of , Is an array , The minimum number of array elements 2 individual , most 5 individual . Each array element is an object , Contains the following attribute values :pathPath, Page path , Must be in pages In the definition of , Required .text,tab Text on , Required .iconPath, Picture path , Not required .icon Size limited to 40kb, The recommended size is 81px*81px, Network pictures are not supported . WhenpositionThe value istopwhen , No display icon.selectedIconPath, The path of the selected image , Not required .icon Size limited to 40kb, The recommended size is 81px*81px, Network pictures are not supported . Whenpositionbytopwhen , No display icon.
Applet project
pages Under the new Page:home( Home page )、camera( Taking pictures )、user( Personal center ).
- pages/home/
home.wxml、home.wxss、home.js、home.json - pages/camera/
camera.wxml、camera.wxss、camera.js、camera.json - pages/user/
user.wxml、user.wxss、user.js、user.json
Create a new folder under the project root directory :static,static I'm gonna go ahead and create a new folder :images,images I'm gonna go ahead and create a new folder :tabIcons,tabIcons Lower storage tabBar Icons to be used .
The main files involved in the code are :
- app.json
- pages/home/home.wxml
- pages/camera/camera.wxml
- pages/user/user.wxml

app.json
{
"pages": [
"pages/home/home",
"pages/camera/camera",
"pages/user/user"
],
"window": {
"navigationBarBackgroundColor": "#971a22",
"navigationBarTitleText": " home page ",
"navigationBarTextStyle": "white"
},
"tabBar": {
"color": "#000000",
"selectedColor": "#971a22",
"backgroundColor": "#ffffff",
"list": [
{
"pagePath": "pages/home/home",
"text": " Home page ",
"iconPath": "/static/images/tabIcons/home.png",
"selectedIconPath": "/static/images/tabIcons/home-fill.png"
},
{
"pagePath": "pages/camera/camera",
"text": " Taking pictures ",
"iconPath": "/static/images/tabIcons/camera.png",
"selectedIconPath": "/static/images/tabIcons/camera-fill.png"
},
{
"pagePath": "pages/user/user",
"text": " Personal center ",
"iconPath": "/static/images/tabIcons/user.png",
"selectedIconPath": "/static/images/tabIcons/user-fill.png"
}
]
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}
pages/home/home.wxml
<view class="camera">
Here is Home Page
</view>
pages/camera/camera.wxml
<view class="camera">
Here is Camera Page
</view>
pages/user/user.wxml
<view class="camera">
Here is User Page
</view>

Related links
边栏推荐
- Basic usage of shell script
- [IVX junior engineer training course 10 papers to get certificates] 09 chat room production
- cookie、session、tooken
- Datawhale 社区黑板报(第1期)
- ACM tutorial - quick sort (regular + tail recursion + random benchmark)
- 2022年6月国产数据库大事记
- 什么是商业养老保险?商业养老保险安全靠谱吗?
- II Basic structure of radio energy transmission system
- GL Studio 5 安装与体验
- Global and Chinese market of wireless charging magnetic discs 2022-2028: Research Report on technology, participants, trends, market size and share
猜你喜欢

How to reflect and solve the problem of bird flight? Why are planes afraid of birds?

教你白嫖Amazon rds一年并搭建MySQL云数据库(只需10分钟,真香)

电商系统中常见的9大坑,你踩过没?

卷积神经网络(包含代码与相应图解)

GL Studio 5 installation and experience

2022年6月国产数据库大事记

The first "mobile cloud Cup" empty publicity meeting, looking forward to working with developers to create a new world of computing!

6-3漏洞利用-SSH环境搭建

We should make clear the branch prediction

MySQL application day02
随机推荐
[eight sorts ①] insert sort (direct insert sort, Hill sort)
学习笔记24--多传感器后融合技术
Tencent cloud techo youth dream campus trip into Wuhan University
DTL dephossite | prediction method of dephosphorylation sites based on Transfer Learning
6-3漏洞利用-SSH环境搭建
Datawhale community blackboard newspaper (issue 1)
Brief description of grafana of # yyds dry goods inventory # Prometheus
SQL injection for Web Security (2)
技术大佬准备就绪,话题C位由你决定
I Brief introduction of radio energy transmission technology
卷积神经网络(包含代码与相应图解)
Based on Simulink and FlightGear, the dynamic control of multi rotor UAV in equilibrium is modeled and simulated
The first "mobile cloud Cup" empty publicity meeting, looking forward to working with developers to create a new world of computing!
CEPH buffer yyds dry inventory
SAP ui5 beginner tutorial XXI - trial version of custom formatter of SAP ui5
Global and Chinese market of avionics systems 2022-2028: Research Report on technology, participants, trends, market size and share
Datawhale 社区黑板报(第1期)
6-3 vulnerability exploitation SSH environment construction
cookie、session、tooken
Global and Chinese markets of edge AI software 2022-2028: Research Report on technology, participants, trends, market size and share