当前位置:网站首页>tabbar的设置
tabbar的设置
2022-07-03 06:01:00 【兰颜】
问:tabbar是做什么的?
答:底部导航
问:有哪些部分组成
答:
"pagePath": "pages/index/index" 页面路径
- "text": "首页" 页面名称
"iconPath":"/images/tabbar/home.png" 没有选中时,展示的图片
"selectedIconPath":"/images/tabbar/home-active.png" 选中时的图片
如图

1. 遇到的第一个问题就是tabbar的设置
文档链接1 uni-app官网
https://uniapp.dcloud.net.cn/collocation/pages.html#tabbar
文档链接 2
uni.setTabBarItem(OBJECT) | uni-app官网
https://uniapp.dcloud.io/api/ui/tabbar.html
2. 把你需要用到的tabbar的图片放到'“static”文件夹里面
3. 按照文档提示的例子,添加我们自己的tabbar(因为我这里已经有写完的百度小程序tabbar,看了一下代码差不多是一样的,所以就直接复制过来)
图1

代码 (其中的xxx替换成自己的页面文件夹名称和页面名称)
"tabBar": {
"list": [{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "static/images/tabbar/home.png",
"selectedIconPath": "static/images/tabbar/home-active.png"
},
{
"pagePath": "pages/xxx/xxx",
"text": "xxx",
"iconPath": "static/images/tabbar/counrty.png",
"selectedIconPath": "static/images/tabbar/country-active.png"
},
{
"pagePath": "pages/xxx/xxx",
"text": "xxx",
"iconPath": "static/images/tabbar/news.png",
"selectedIconPath": "static/images/tabbar/news-active.png"
},
{
"pagePath": "pages/xxx/xxx",
"text": "xxx",
"iconPath": "static/images/tabbar/ask.png",
"selectedIconPath": "static//images/tabbar/ask-active.png"
},
{
"pagePath": "pages/xxx/xxx",
"text": "xxx",
"iconPath": "static/images/tabbar/me.png",
"selectedIconPath": "static//images/tabbar/me-active.png"
}
],
"backgroundColor": "#ffffff",
"borderStyle": "white",
"color": "#000",
"selectedColor": "#6495ED"
},这样弄完之后,你的项目就拥有了一个底部导航啦
这里多说一些别的,

- pages是配置页面路径的,一组花括号代表了一个页面的配置
- path 是页面在项目中的路径
- navigationBarTitleText 是页面的标题
边栏推荐
- Kubernetes notes (I) kubernetes cluster architecture
- Kubernetes notes (VI) kubernetes storage
- Method of finding prime number
- How to create and configure ZABBIX
- Analysis of Clickhouse mergetree principle
- Today, many CTOs were killed because they didn't achieve business
- [teacher Zhao Yuqiang] index in mongodb (Part 2)
- 2022.7.2 simulation match
- Apple submitted the new MAC model to the regulatory database before the spring conference
- Kubernetes notes (VIII) kubernetes security
猜你喜欢
![[advanced pointer (2)] | [function pointer, function pointer array, callback function] key analysis + code explanation](/img/9b/a309607c037b0a18ff6b234a866f9f.jpg)
[advanced pointer (2)] | [function pointer, function pointer array, callback function] key analysis + code explanation

Solve the problem of automatic disconnection of SecureCRT timeout connection

Exception when introducing redistemplate: noclassdeffounderror: com/fasterxml/jackson/core/jsonprocessingexception

从小数据量 MySQL 迁移数据到 TiDB

Kubernetes notes (IV) kubernetes network

Method of finding prime number

Skywalking8.7 source code analysis (II): Custom agent, service loading, witness component version identification, transform workflow
![[function explanation (Part 2)] | [function declaration and definition + function recursion] key analysis + code diagram](/img/29/1644588927226a49d4b8815d8bc196.jpg)
[function explanation (Part 2)] | [function declaration and definition + function recursion] key analysis + code diagram

Apt update and apt upgrade commands - what is the difference?

PHP notes are super detailed!!!
随机推荐
[escape character] [full of dry goods] super detailed explanation + code illustration!
2022.6.30DAY591
[teacher Zhao Yuqiang] the most detailed introduction to PostgreSQL architecture in history
[function explanation (Part 2)] | [function declaration and definition + function recursion] key analysis + code diagram
[untitled]
QT read write excel -- qxlsx insert chart 5
JDBC connection database steps
Simple handwritten ORM framework
Why should there be a firewall? This time xiaowai has something to say!!!
How does win7 solve the problem that telnet is not an internal or external command
Personal outlook | looking forward to the future from Xiaobai's self analysis and future planning
Strategy pattern: encapsulate changes and respond flexibly to changes in requirements
[teacher Zhao Yuqiang] use the catalog database of Oracle
Alibaba cloud Alipay sandbox payment
Error 1045 (28000) occurs when Linux logs in MySQL: access denied for user 'root' @ 'localhost' (using password: yes)
Using the ethtool command by example
Common exceptions when Jenkins is released (continuous update...)
Maximum likelihood estimation, divergence, cross entropy
pytorch 多分类中的损失函数
从小数据量分库分表 MySQL 合并迁移数据到 TiDB
https://uniapp.dcloud.net.cn/collocation/pages.html#tabbar