当前位置:网站首页>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
边栏推荐
- Han Zhichao: real time risk control practice of eBay based on graph neural network
- Global and Chinese markets for context and location-based services 2022-2028: Research Report on technology, participants, trends, market size and share
- Learning note 3 -- Key Technologies of high-precision map (Part 1)
- 2022年6月国产数据库大事记
- Global and Chinese markets of edge AI software 2022-2028: Research Report on technology, participants, trends, market size and share
- GL Studio 5 安装与体验
- Global and Chinese markets of digital crosspoint switches and mux/demux 2022-2028: Research Report on technology, participants, trends, market size and share
- ACM tutorial - quick sort (regular + tail recursion + random benchmark)
- 8.8.4-PointersOnC-20220215
- 电商系统中常见的9大坑,你踩过没?
猜你喜欢

GL Studio 5 安装与体验

【八大排序②】选择排序(选择排序,堆排序)

Design and control of multi rotor aircraft (VII) -- sensor calibration and measurement model

6-3 vulnerability exploitation SSH environment construction

How does schedulerx help users solve the problem of distributed task scheduling?
![[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

6-2漏洞利用-ftp不可避免的问题

How can I batch produce the same title for the video?

关于ASP.NET CORE使用DateTime日期类型参数的一个小细节

Excel PivotTable
随机推荐
How to reflect and solve the problem of bird flight? Why are planes afraid of birds?
About asp Net core uses a small detail of datetime date type parameter
Mitsubishi PLC FX3U pulse axis jog function block (mc_jog)
Edge computing accelerates live video scenes: clearer, smoother, and more real-time
教你白嫖Amazon rds一年并搭建MySQL云数据库(只需10分钟,真香)
Load and domcontentloaded in JS
NeRV: Neural Reflectance and Visibility Fields for Relighting and View Synthesis
Tencent cloud techo youth dream campus trip into Wuhan University
[IVX junior engineer training course 10 papers] 04 canvas and a group photo of IVX and me
UDS bootloader of s32kxxx bootloader
[IVX junior engineer training course 10 papers to get certificates] 01 learn about IVX and complete the New Year greeting card
Global and Chinese market of picture archiving and communication system (PACS) 2022-2028: Research Report on technology, participants, trends, market size and share
Hcip day 14 (MPLS protocol)
Recommend an online interface mock tool usemock
[Obsidian] wechat is sent to Obsidian using remotely save S3 compatibility
Learning notes 25 - multi sensor front fusion technology
Global and Chinese markets of edge AI software 2022-2028: Research Report on technology, participants, trends, market size and share
Brief description of grafana of # yyds dry goods inventory # Prometheus
Mathematics - feelings -20220215
Excel search and reference function