vue 底部bottomnav
<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>
vue 底部bottomnav的更多相关文章
- vue底部导航的精准显示
让底部导航只显示在一级页面: 路由中的写法: import Vue from 'vue' import Router from 'vue-router' //import HelloWorld fro ...
- Vue——轻松实现vue底部点击加载更多
前言 需求总是不断改变的,好吧,今天就把vue如何实现逐步加载更多和分布加载更多说下,默认你知道如何去请求数据的哈 一次请求 页面 使用slice来进行限制展现从0,a的数据 <div v-fo ...
- js 仿微信投诉—引入vue.js,拆分组件为单个js
效果 页面目录 index.html <!DOCTYPE html > <html> <head> <meta charset="UTF-8&quo ...
- Vue(小案例_vue+axios仿手机app)_Vuex优化购物车功能
一.前言 1.用vuex实现加入购物车操作 2.购物车详情页面 3.点击删除按钮,删除购物详情页面里的对应商品 二.主要内容 1.用vuex加入购物车 (1)在src ...
- Vue(小案例_vue+axios仿手机app)_购物车
一.前言 1.购物车 二.主要内容 1.效果演示如下,当我们选择商品数量改变的时候,也要让购物车里面的数据改变 2.具体实现 (1)小球从上面跳到下面的效果 (2)当点击上面的“加入购物车按钮”让小球 ...
- CSS常用选择器名
一.页面结构划分 box 盒子wrap 包裹container 容器 header 头部main 主要区域footer 底部 content 内容区域banner 横幅广告区域menu 菜单 二.模块 ...
- Vue2 全家桶仿 微信App 项目,支持多人在线聊天和机器人聊天
前言 这个项目是利用工作之余写的一个模仿微信app的单页面应用,整个项目包含27个页面,涉及实时群聊,机器人聊天,同学录,朋友圈等等,后续页面还是开发中.写这个项目主要目的是练习和熟悉vue和vuex ...
- vue2.0+node.js+mongodb全栈打造商城
Github地址:https://github.com/ccyinghua/vue-node-mongodb-project 一.构建项目所用: vue init webpack vue-node-m ...
- vue2.0 仿手机新闻站(七)过滤器、动画效果
1.全局过滤器 (1)normalTime.js 自定义 将 时间戳 转换成 日期格式 过滤器 /** * 将 时间戳 转换成 日期格式 */ export const normalTime = ( ...
随机推荐
- android 6.1解锁
1.adb reboot bootloader 2.fastboot flashing unlock 3.power 键即可
- uefi bios安装ubuntu16.04 (win10和ubuntu双系统)
哎呀,没事闲的装双系统,按照晚上的教程装半天也没成功,后来才知道是自己电脑的问题,当然也有那些过时的博客的问题! ultraiso制作ubuntu u盘启动盘 http://www.cr173.co ...
- html5音频视频专题
html5音频视频专题 总结 1. 操作的就是video和audio两个对象,这两个对象有他们的属性和方法,通过对象的id就可以操作他们 <audio src="../video/琴箫 ...
- B1826 [JSOI2010]缓存交换 贪心+离散化+堆
这个题仔细一想可以直接贪心做,因为队列里下一个出现的早的一定最优.正确性显然.然后我只拿了50,我直接模拟另一个队列暴力修改最后一个点的nxt值,自然会T.但是其实不用修改,直接插入就行了前面的不影响 ...
- Input 内提示填写内容
输入框内提示默认内容,用户的点击后提示内容消失,如果填写内容为空,失去焦点后自动显示提示内容 <input type="text" value="搜索" ...
- go 学习成长之路
一.go的搭建 二.初识go 三.混个脸熟--go 四.go的语言结构 五.go的常量与变量 六.go基础数据类型 七.go 条件语句 八.go 运算符 九.go条件语句switch 十.go循环语句 ...
- 关于 android屏幕适配
一.关于布局适配 1.不要使用绝对布局 2.尽量使用match_parent 而不是fill_parent . 3.能够使用权重的地方尽量使用权重(android:layout_weight) 4.如 ...
- AndroidManifest.xml详解
一.关于AndroidManifest.xml AndroidManifest.xml 是每个android程序中必须的文件.它位于整个项目的根目录,描述了package中暴露的组件(activiti ...
- SQL--大解密之组织数据
今天为大家带来的是数据库的基本用法 首先带大家了解下数据库. 大量的数据正在不断产生,伴随而来的是如何安全有效地存储.检索.管理他们. 对数据的有效存储.高效访问.方便共享和安全控制等问题成为信息 ...
- Tcl之Lab1
Task 1. Use help 1) What is the default switch for the redirect command? -file help -v redirect # or ...