当前位置:网站首页>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 是页面的标题
边栏推荐
- 从小数据量分库分表 MySQL 合并迁移数据到 TiDB
- Kubernetes notes (I) kubernetes cluster architecture
- [teacher Zhao Yuqiang] index in mongodb (Part 1)
- BeanDefinitionRegistryPostProcessor
- 【一起上水硕系列】Day 10
- 70 shell script interview questions and answers
- MySQL 5.7.32-winx64 installation tutorial (support installing multiple MySQL services on one host)
- Using the ethtool command by example
- AtCoder Beginner Contest 258(A-D)
- Download the corresponding version of chromedriver
猜你喜欢

项目总结--2(Jsoup的基本使用)

Redhat7系统root用户密码破解

Core principles and source code analysis of disruptor
![[teacher Zhao Yuqiang] MySQL flashback](/img/93/75998e28fd309880661ea723dc8de6.jpg)
[teacher Zhao Yuqiang] MySQL flashback

Kubernetes notes (VII) kuberetes scheduling
![[teacher Zhao Yuqiang] use the catalog database of Oracle](/img/0b/73a7d12caf955dff17480a907234ad.jpg)
[teacher Zhao Yuqiang] use the catalog database of Oracle

Solve the problem of automatic disconnection of SecureCRT timeout connection

Kubernetes notes (II) pod usage notes

Simple solution of small up main lottery in station B
![[escape character] [full of dry goods] super detailed explanation + code illustration!](/img/33/ec5a5e11bfd43f53f2767a9a0f0cc9.jpg)
[escape character] [full of dry goods] super detailed explanation + code illustration!
随机推荐
The most responsible command line beautification tutorial
Pytorch builds the simplest version of neural network
Configure DTD of XML file
How to create and configure ZABBIX
2022.DAY592
Kubernetes notes (VIII) kubernetes security
The server data is all gone! Thinking caused by a RAID5 crash
[teacher Zhao Yuqiang] use Oracle's tracking file
Kubernetes notes (V) configuration management
[branch and cycle] | | super long detailed explanation + code analysis + a trick game
从小数据量 MySQL 迁移数据到 TiDB
Redis encountered noauth authentication required
Alibaba cloud OOS file upload
How does win7 solve the problem that telnet is not an internal or external command
QT read write excel -- qxlsx insert chart 5
NG Textarea-auto-resize
Final review (Day2)
[explain in depth the creation and destruction of function stack frames] | detailed analysis + graphic analysis
Sorry, this user does not exist!
The programmer shell with a monthly salary of more than 10000 becomes a grammar skill for secondary school. Do you often use it!!!
https://uniapp.dcloud.net.cn/collocation/pages.html#tabbar