当前位置:网站首页>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
边栏推荐
- 站在新的角度来看待产业互联网,并且去寻求产业互联网的正确方式和方法
- Global and Chinese markets for maritime services 2022-2028: Research Report on technology, participants, trends, market size and share
- uTools
- Excel PivotTable
- Learning note 24 - multi sensor post fusion technology
- 6-2漏洞利用-ftp不可避免的问题
- [eight sorts ①] insert sort (direct insert sort, Hill sort)
- Since I understand the idea of dynamic planning, I have opened the door to a new world
- Learning note 3 -- Key Technologies of high-precision map (Part 1)
- Fastadmin controls the length of fields in the table
猜你喜欢

Learning notes 25 - multi sensor front fusion technology

Appium inspector can directly locate the WebView page. Does anyone know the principle

Exclusive delivery of secret script move disassembly (the first time)

Infiltration records of CFS shooting range in the fourth phase of the western regions' Dadu Mansion

The concept and application of Cartland number

How does schedulerx help users solve the problem of distributed task scheduling?
![[IVX junior engineer training course 10 papers to get certificates] 03 events and guessing numbers games](/img/69/44219af52baef20cedec3870147589.jpg)
[IVX junior engineer training course 10 papers to get certificates] 03 events and guessing numbers games

PLC Analog input analog conversion FB s_ ITR (Mitsubishi FX3U)

Learning note 3 -- Key Technologies of high-precision map (Part 1)

Review notes of compilation principles
随机推荐
Datawhale community blackboard newspaper (issue 1)
GL Studio 5 安装与体验
UDS bootloader of s32kxxx bootloader
uTools
CTF daily question day45 sensor
学习笔记2--高精度地图定义及价值
Global and Chinese markets for the application of artificial intelligence in security, public security and national security 2022-2028: Research Report on technology, participants, trends, market size
Basic usage of three JS high-order functions --filter---map---reduce
【八大排序④】归并排序、不基于比较的排序(计数排序、基数排序、桶排序)
[rust web rokcet Series 1] Hello, world and get, post, put, delete
[image enhancement] vascular image enhancement based on frangi filter with matlab code
I'll teach you to visit Amazon RDS for a year and build a MySQL cloud database (only 10 minutes, really fragrant)
Just using the way and method of consuming the Internet to land and practice the industrial Internet will not bring long-term development
Day 13 of hcip (relevant contents of BGP agreement)
Data visualization in medical and healthcare applications
Entrepreneurship is a little risky. Read the data and do a business analysis
Global and Chinese market of avionics systems 2022-2028: Research Report on technology, participants, trends, market size and share
卷积神经网络(包含代码与相应图解)
ACM tutorial - quick sort (regular + tail recursion + random benchmark)
Basic number theory -- Gauss elimination