uni-app之tabBar的自己配置
1.因为产品相关的的权限,需要配置不同的导航,这时候需要自定义导航。分离出来的就是一个小的组件。(tabBar.vue)
此处暂时用的html插入的代码,能粘贴到vue文件即可。
<template>
<view class="tabBar">
<view v-for="(item,index) in tabBar" :key="item.url" class="tabbar_item" :class="{'active':item.url == currentPage}"
@click="navTo(item,index)">
<image v-if="item.url == currentPage" :src="item.imgClick" mode=""></image>
<image v-else :src="item.imgNormal" mode=""></image>
<view class="text">{{item.text}}</view>
</view>
</view>
</template>
<script>
export default {
props: {
currentPage: {
type: String,
default: 'index'
}
},
data() {
return {
tabBar: [{
url: 'information',
text: '消息',
imgNormal:'../../static/images/information.png',
imgClick:'../../static/images/active/information_active.png'
},
{
url: 'officialPartner',
text: '合作商',
imgNormal:'../../static/images/officialPartner.png',
imgClick:'../../static/images/active/offPartner_active.png'
},
{
url: 'stock',
text: '库存',
imgNormal:'../../static/images/stock.png',
imgClick:'../../static/images/active/stock_active.png'
}, {
url: 'product',
text: '产品',
imgNormal:'../../static/images/product.png',
imgClick:'../../static/images/active/product_active.png'
}, {
url: 'mine',
text: '我的',
imgNormal:'../../static/images/mine.png',
imgClick:'../../static/images/active/mine_active.png'
}
],
level:'' };
},mounted(){
let userlevel = uni.getStorageSync('level');
/* console.log(userlevel); */
let _this = this;
if (userlevel== 1) {
_this.tabBar.splice(3, 1);
} else {
_this.tabBar.splice(1,1);
_this.tabBar.splice(1,1);
}
},
created() {
uni.hideTabBar({})
},
computed: { },
methods: {
navTo(item,index) {
let _this = this;
if (item.url !== _this.currentPage) {
var isUrl = `/pages/${item.url}/${item.url}`
const that = this
uni.switchTab({
url: isUrl
})
} else {
/* this.$parent.toTop() */
}
}
}
}
</script>
<style lang="scss" scoped>
//导航栏设置
$isRadius:20upx; //左上右上圆角
$isWidth:100vw; //导航栏宽度
$isBorder:1px solid #eeeeee; //边框 不需要则设为0px
$isBg:white; //背景 // 选中设置
$chooseTextColor:#1b60ac; //选中时字体颜色
$chooseBgColor:white; //选中时背景颜色 transparent为透明 //未选中设置
$normalTextColor:#999; //未选中颜色 .tabBar {
width: $isWidth;
height: 100upx;
position: fixed;
bottom: 10upx;
left: 0;
right: 0;
margin: 0 auto;
z-index: 998;
background-color: $isBg;
color: $normalTextColor;
border-left: $isBorder;
border-top: $isBorder;
border-right: $isBorder;
display: flex;
justify-content: space-around;
border-top-right-radius: $isRadius;
border-top-left-radius: $isRadius;
box-sizing: border-box;
overflow: hidden; .tabbar_item {
width: 25%;
font-size: 12px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center; &.active {
/* border-left: $isBorder;
border-top: $isBorder; */
background: $chooseBgColor;
color: $chooseTextColor;
}
} image {
width: 36upx;
height: 36upx;
margin-left: 5upx;
}
}
</style>
2、页面引入。


uni-app之tabBar的自己配置的更多相关文章
- uni app中使用自定义图标库
项目中难免会用到自定义图标,那在uni app中应该怎么使用呢? 首先, 将图标目录放在static资源目录下: 在main.js中引入就可以全局使用了 import '@/static/icon-o ...
- uni app 零基础小白到项目实战-1
uni-app是一个使用vue.js开发跨平台应用的前端框架. 开发者通过编写vue.js代码,uni-app将其编译到Ios,android,微信小程序等多个平台,保证其正确并达到优秀体验. Uni ...
- 微信小程序app.json文件常用全局配置
小程序根目录下的 app.json 文件用来对微信小程序进行全局配置,决定页面文件的路径.窗口表现.设置网络超时时间.设置多 tab 等. JOSN文件不允许注释,下面为了学习加上注释,粘贴需要的片段 ...
- winform app.config文件的动态配置
获取 获取应用程序exe.config文件中 节点value值 /// <summary> /// 功能: 读取应用程序exe.config文件中 /// appSettings节点下 ...
- 在Web.config或App.config中的添加自定义配置
.Net中的System.Configuration命名空间为我们在web.config或者app.config中自定义配置提供了完美的支持.最近看到一些项目中还在自定义xml文件做程序的配置,所以忍 ...
- 使用ionic与cordova(phonegap)进行轻量级app开发前的环境配置与打包安卓apk过程记录
前言 有人说:"如果你恨一个人,就让ta去接触cordova(phonegap)",这是因为这里面的水很深,坑很多,真让人不是一般地发狂.或许有幸运的人儿基本顺顺利利就配置完环境 ...
- vue.js移动端app实战1:初始配置
本系列将会用vue.js2制作一个移动端的webapp单页面,页面不多,大概在7,8个左右,不过麻雀虽小,五脏俱全,常用的效果如轮播图,下拉刷新,上拉加载,图片懒加载都会用到.css方面也会有一些描述 ...
- 在Web.config或App.config中的添加自定义配置 <转>
.Net中的System.Configuration命名空间为我们在web.config或者app.config中自定义配置提供了完美的支持.最近看到一些项目中还在自定义xml文件做程序的配置 ...
- [.net]手机APP与IIS服务器联调配置
前端时间写过一段时间接口,在后期的时候,出现了一些无法通过查看日志来找出问题所在的bug.于是,将手机APP连接到IIS服务器上进行调试,下面是配置的具体步骤 1. 配置IIS 添加网站,将物理路径 ...
随机推荐
- Java线程池的使用方式,核心运行原理、以及注意事项
为什么需要线程池 java中为了提高并发度,可以使用多线程共同执行,但是如果有大量线程短时间之内被创建和销毁,会占用大量的系统时间,影响系统效率. 为了解决上面的问题,java中引入了线程池,可以使创 ...
- 暴力解决HTMLTestRunner出现dict() ->new empty dictionary的问题
在使用ddt数据驱动之后,HTMLTestRunner报告的用例名称之后出现dict() ->new empty dictionary,如下图所示: 经排查,发现是因为ddt源码中test_do ...
- [MA] 有关 Likelihood
当提到 Linear Regression 或是 Logistic regression 等关键词时,都会涉及一个概念,叫做 Likelihood Function 以及 Maximum Likeli ...
- pandas数据结构之基础运算笔记
import pandas as pd import numpy as np s = pd.Series([1,3,5,6,8],index=list('acefh')) s.index # 读取行索 ...
- linux 安装xdebug
一.安装了 xdebug php -m | grep 'xdebug' 如果没有安装就执行 首先根据 phpinfo() 信息 下载对应的版本,具体看参数: 下载地址:https://xdebug.o ...
- java实现带过期时间的缓存
private static ScheduledExecutorService swapExpiredPool = new ScheduledThreadPoolExecutor(10); priva ...
- 将物理机系统转为虚拟机系统 p2v
ref : https://blog.csdn.net/gsls200808/article/details/77932713 背景: 在公司有台机子主要负责某产品的升级与维护,出于各种原因,该产品需 ...
- hdu 4504 dp问题 转化能力不够 对状态的转移也是不够
威威猫系列故事——篮球梦 Time Limit: 300/100 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total ...
- 如何把Windows主机中的文件拉到centOS虚拟机中
如何把Windows主机中的文件拉到centOS虚拟机中 2017年02月19日 22:19:12 Ariel_lin2017 阅读数:6023 标签: vmware tools共享文件 之前写了 ...
- default(Nullable(type)) vs default(type)
default(Nullable<long>) == null default(long?) == null default(long) == 0L