vue 底部bottomnav
2024-08-24 06:21:00
<template>
<div id="foot">
<div class="tabBar">
<div class="menu"><p class="cont"> <router-link to='/'><img src="./img/tabBar1.png" alt="" class="src" height="47px" ></router-link><span v-bind:class="{active:routerCurrent==1}"> 首页</span> </p></div>
<div class="menu"><p class="cont"> <router-link to='/SignIn'><img src="./img/tabBar2.png" alt="" class="src" height="47px"></router-link><span v-bind:class="{active:routerCurrent==2}"> 签到</span> </p></div>
<div class="menu"><p class="cont"> <router-link to='/prize'><img src="./img/tabBar3.png" alt="" class="src" height="47px"></router-link><span v-bind:class="{active:routerCurrent==3}"> 福利</span> </p></div>
<div class="menu"><p class="cont"> <router-link to='/my'><img src="./img/tabBar4.png" alt="" class="src" height="47px"></router-link><span v-bind:class="{active:routerCurrent==4}"> 我的</span> </p></div>
</div>
</div>
</template>
<script>
export default {
data(){
return{
routerCurrent :1 ,
}
},
created () {
this.getRouter();
},
watch: {
$route() {
this.getRouter();
}
},
methods: {
//获取当前处于哪一个路由
getRouter() {
if (this.$route.path == "/") {
this.routerCurrent = 1;
}
if (this.$route.path == "/SignIn") {
this.routerCurrent = 2;
}
if (this.$route.path == "/prize") {
this.routerCurrent = 3;
}
if (this.$route.path == "/my") {
this.routerCurrent = 4;
}
console.log(this.$route.path);
},
},
mounted () { } }
</script>
<style scoped lang="scss">
#foot{
height: 1.47rem;
position: fixed;
width: 100vw;
background: #fff;
bottom: 0;
.active{
color: #e4007f;
}
.tabBar{
margin: 0 0.2rem;
height:100%;
display: flex;
text-align:center;
display:-webkit-flex;
flex-wrap:nowrap;
flex-direction:reverse;
justify-content:space-between;
.menu{
a{
display: block;
margin: 0.1rem auto -0.25rem;
}
span{
font-size: 16px;
}
} }
} </style>
上面的是组件,下面的是调用
<template>
<div id="my">
<div class="head"></div>
<div class="pic">
<div class="cover">
<i class="el-icon-message"></i>
</div>
</div>
<!-- 底部nav -->
<foot :parentMessage="routerPath"></foot>
</div>
</template>
<script>
import foot from '@/components/foot/foot' export default {
data(){
return{
routerPath:''
}
},
components: {
foot
},
mounted () {
this.routerPath=this.$route.path
// console.log(this.$route.path);background: url('../assets/img/my-bg.png') no-repeat;
} }
</script>
<style scoped lang="scss">
#my{
.pic{
height: 6.53rem;
position: relative; background-size:cover;
.cover{
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 999;
background: rgba(0, 0, 0, 0.5); }
}
}
</style>
最新文章
- 从零自学Hadoop(22):HBase协处理器
- p2p网贷系统即将上线
- asp.net动态生成按钮Button控件
- VMware“该虚拟机似乎正在使用中”问题
- BizTalk开发系列(十) ESB Guidance安装笔记
- 用C语言写的双色球
- gitlab 配置邮箱
- [Java Basics] Stack, Heap, Constructor, I/O, Immutable, ClassLoader
- Nginx启动SSL功能,并进行功能优化,你看这个就足够了
- ElasticSearch中文分词(IK)
- Mesh Baker的基本操作与功能演示
- JPA事务回滚配置
- 未能加载文件或程序集“System.Web.Helpers, Version=2.0.0.0(转)
- 乐在其中设计模式(C#) - 解释器模式(Interpreter Pattern)
- Ajax请求访问action推断文件是否存在
- AI 人工智能 探索 (八)
- STL总结
- 【ARTS】01_10_左耳听风-20190114~20190120
- Windows环境安装Django步骤
- nginx命令大全
热门文章
- 【转】Android使用XML Shape绘制带阴影效果的圆形按钮
- docker run Influxdb
- P3567 [POI2014]KUR-Couriers 主席树
- JZOJ 1667 ( bzoj 1801 ) [ AHOI 2009 ] 中国象棋 —— DP
- 支持HTTP2的cURL——基于Alpine的最小化Docker镜像
- php phppowerpoint
- [Swift通天遁地]七、数据与安全-(6)管理文件夹和创建并操作文件
- redis过期策略和内存淘汰机制
- pip使用豆瓣镜像源
- ACM_二维数组的查找