当前位置:网站首页>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 是页面的标题
边栏推荐
- 多线程与高并发(7)——从ReentrantLock到AQS源码(两万字大章,一篇理解AQS)
- The most responsible command line beautification tutorial
- Understand expectations (mean / estimate) and variances
- Simple solution of small up main lottery in station B
- Btrfs and ext4 - features, strengths and weaknesses
- [branch and cycle] | | super long detailed explanation + code analysis + a trick game
- [trivia of two-dimensional array application] | [simple version] [detailed steps + code]
- PHP notes are super detailed!!!
- Ext4 vs XFS -- which file system should you use
- Kubernetes notes (IV) kubernetes network
猜你喜欢
Exception when introducing redistemplate: noclassdeffounderror: com/fasterxml/jackson/core/jsonprocessingexception
项目总结--2(Jsoup的基本使用)
[together Shangshui Shuo series] day 7 content +day8
[teacher Zhao Yuqiang] redis's slow query log
Kubernetes notes (VI) kubernetes storage
多线程与高并发(7)——从ReentrantLock到AQS源码(两万字大章,一篇理解AQS)
理解 YOLOV1 第一篇 预测阶段
【一起上水硕系列】Day 10
智牛股项目--04
pytorch 多分类中的损失函数
随机推荐
MySQL startup error: several solutions to the server quit without updating PID file
1. 兩數之和
[teacher Zhao Yuqiang] RDB persistence of redis
JS implements the problem of closing the current child window and refreshing the parent window
2022.7.2day594
Detailed explanation of iptables (1): iptables concept
Skywalking8.7 source code analysis (II): Custom agent, service loading, witness component version identification, transform workflow
[set theory] relational closure (reflexive closure | symmetric closure | transitive closure)
[advanced pointer (1)] | detailed explanation of character pointer, pointer array, array pointer
Redis cannot connect remotely.
JDBC connection database steps
88. Merge two ordered arrays
Complete set of C language file operation functions (super detailed)
It is said that the operation and maintenance of shell scripts are paid tens of thousands of yuan a month!!!
Strategy pattern: encapsulate changes and respond flexibly to changes in requirements
智牛股项目--04
Final review (Day7)
Final review (day3)
How to create your own repository for software packages on Debian
理解 期望(均值/估计值)和方差