当前位置:网站首页>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 是页面的标题
边栏推荐
- Sophomore dilemma (resumption)
- [advanced pointer (1)] | detailed explanation of character pointer, pointer array, array pointer
- [teacher Zhao Yuqiang] MySQL high availability architecture: MHA
- Code generator - single table query crud - generator
- Leetcode solution - 01 Two Sum
- 1. Somme des deux nombres
- Introduction to redis using Lua script
- [teacher Zhao Yuqiang] use Oracle's tracking file
- Redis encountered noauth authentication required
- [escape character] [full of dry goods] super detailed explanation + code illustration!
猜你喜欢
![Ensemble, série shuishu] jour 9](/img/39/c1ba1bac82b0ed110f36423263ffd0.png)
Ensemble, série shuishu] jour 9

Understand the first prediction stage of yolov1

Understand one-way hash function
![[video of Teacher Zhao Yuqiang's speech on wot] redis high performance cache and persistence](/img/a7/2140744ebad9f1dc0a609254cc618e.jpg)
[video of Teacher Zhao Yuqiang's speech on wot] redis high performance cache and persistence

Clickhouse learning notes (I): Clickhouse installation, data type, table engine, SQL operation
![[teacher Zhao Yuqiang] RDB persistence of redis](/img/cc/5509b62756dddc6e5d4facbc6a7c5f.jpg)
[teacher Zhao Yuqiang] RDB persistence of redis

Skywalking8.7 source code analysis (I): agent startup process, agent configuration loading process, custom class loader agentclassloader, plug-in definition system, plug-in loading

Simple solution of small up main lottery in station B

一起上水硕系列】Day 9

智牛股项目--05
随机推荐
Sorry, this user does not exist!
QT read write excel -- qxlsx insert chart 5
[teacher Zhao Yuqiang] index in mongodb (Part 2)
[function explanation (Part 1)] | | knowledge sorting + code analysis + graphic interpretation
There is no one of the necessary magic skills PXE for old drivers to install!!!
AtCoder Beginner Contest 258(A-D)
最大似然估计,散度,交叉熵
C 语言文件操作函数大全 (超详细)
Disruptor learning notes: basic use, core concepts and principles
Qt读写Excel--QXlsx插入图表5
【一起上水硕系列】Day 7 内容+Day8
Life is a process of continuous learning
Synthetic keyword and NBAC mechanism
Leetcode solution - 01 Two Sum
[trivia of two-dimensional array application] | [simple version] [detailed steps + code]
[video of Teacher Zhao Yuqiang's speech on wot] redis high performance cache and persistence
70 shell script interview questions and answers
智牛股项目--05
Detailed explanation of contextclassloader
If function of MySQL
https://uniapp.dcloud.net.cn/collocation/pages.html#tabbar