当前位置:网站首页>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 是页面的标题
边栏推荐
- Detailed explanation of iptables (1): iptables concept
- Solve the problem of automatic disconnection of SecureCRT timeout connection
- chromedriver对应版本下载
- Skywalking8.7 source code analysis (II): Custom agent, service loading, witness component version identification, transform workflow
- BeanDefinitionRegistryPostProcessor
- C 语言文件操作函数大全 (超详细)
- 一起上水碩系列】Day 9
- 理解 期望(均值/估计值)和方差
- [teacher Zhao Yuqiang] MySQL high availability architecture: MHA
- Ext4 vs XFS -- which file system should you use
猜你喜欢
The most responsible command line beautification tutorial
Disruptor learning notes: basic use, core concepts and principles
Error 1045 (28000) occurs when Linux logs in MySQL: access denied for user 'root' @ 'localhost' (using password: yes)
Redhat7 system root user password cracking
Capacity expansion mechanism of map
Core principles and source code analysis of disruptor
Sophomore dilemma (resumption)
SVN分支管理
Clickhouse learning notes (I): Clickhouse installation, data type, table engine, SQL operation
伯努利分布,二项分布和泊松分布以及最大似然之间的关系(未完成)
随机推荐
Download the corresponding version of chromedriver
Apache+php+mysql environment construction is super detailed!!!
[teacher Zhao Yuqiang] Cassandra foundation of NoSQL database
JS implements the problem of closing the current child window and refreshing the parent window
MySQL startup error: several solutions to the server quit without updating PID file
深度学习,从一维特性输入到多维特征输入引发的思考
Convolution operation in convolution neural network CNN
Kubernetes cluster environment construction & Deployment dashboard
Ensemble, série shuishu] jour 9
Clickhouse learning notes (I): Clickhouse installation, data type, table engine, SQL operation
[Shangshui Shuo series together] day 10
Analysis of Clickhouse mergetree principle
Common exceptions when Jenkins is released (continuous update...)
PHP notes are super detailed!!!
Kubernetes notes (IV) kubernetes network
Configure DTD of XML file
智牛股--03
chromedriver对应版本下载
JDBC connection database steps
【一起上水硕系列】Day 7 内容+Day8