当前位置:网站首页>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
边栏推荐
- Mitsubishi PLC FX3U pulse axis jog function block (mc_jog)
- The first "mobile cloud Cup" empty publicity meeting, looking forward to working with developers to create a new world of computing!
- Daily work and study notes
- 首场“移动云杯”空宣会,期待与开发者一起共创算网新世界!
- With the acquisition of Xilinx, AMD is more than "walking on two legs" | Jiazi found
- Excel PivotTable
- Two TVs
- 学习笔记25--多传感器前融合技术
- [IVX junior engineer training course 10 papers to get certificates] 09 chat room production
- Basic usage of shell script
猜你喜欢

Unity AssetBundle subcontracting

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

Entrepreneurship is a little risky. Read the data and do a business analysis

SAP ui5 beginner tutorial XXI - trial version of custom formatter of SAP ui5
![[eight sorts ④] merge sort, sort not based on comparison (count sort, cardinal sort, bucket sort)](/img/0d/22f3f65ab9422383df9a55d0724d59.jpg)
[eight sorts ④] merge sort, sort not based on comparison (count sort, cardinal sort, bucket sort)

学习笔记2--高精度地图定义及价值

XMIND mind map
![[IVX junior engineer training course 10 papers] 05 canvas and aircraft war game production](/img/dc/e9adb1b41c2175c6f18d8027e0530a.jpg)
[IVX junior engineer training course 10 papers] 05 canvas and aircraft war game production

Day 13 of hcip (relevant contents of BGP agreement)
![[IVX junior engineer training course 10 papers to get certificates] 0708 news page production](/img/ad/a1cb672d2913b6befd6d8779c993ec.jpg)
[IVX junior engineer training course 10 papers to get certificates] 0708 news page production
随机推荐
What is commercial endowment insurance? Is commercial endowment insurance safe?
No converter found for return value of type: class
Learning note 3 -- Key Technologies of high-precision map (Part 1)
Liteos learning - first knowledge of development environment
I'll teach you to visit Amazon RDS for a year and build a MySQL cloud database (only 10 minutes, really fragrant)
GL Studio 5 安装与体验
教你白嫖Amazon rds一年并搭建MySQL云数据库(只需10分钟,真香)
站在新的角度来看待产业互联网,并且去寻求产业互联网的正确方式和方法
Principle of finding combinatorial number and template code
学习笔记25--多传感器前融合技术
Altium designer measure distance (ctrl+m)
"C zero foundation introduction hundred knowledge hundred examples" (73) anonymous function -- lambda expression
Global and Chinese markets for distributed generation and energy storage in telecommunications networks 2022-2028: Research Report on technology, participants, trends, market size and share
技术大佬准备就绪,话题C位由你决定
Deb file installation
Exclusive delivery of secret script move disassembly (the first time)
卷积神经网络(包含代码与相应图解)
Comprehensive broadcast of global and Chinese markets 2022-2028: Research Report on technology, participants, trends, market size and share
CTF daily question day45 sensor
微信小程序中使用tabBar