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 = ( ...
随机推荐
- SQL 字符串处理函数大全
select语句中只能使用sql函数对字段进行操作(链接sql server),select 字段1 from 表1 where 字段1.IndexOf("云")=1;这条语句不对 ...
- CodeForces - 556D
D. Case of Fugitive time limit per test 3 seconds memory limit per test 256 megabytes input standard ...
- BZOJ 2001 线段树+LCT (TLE)
同是O(nlog^2n)怎么常数差距就这么大呢,,, 同是LCT 怎么我的和Po姐姐的常数差距就这么大呢 我绝对是脑子被驴踢了才写这个垃圾算法 //By SiriusRen #include < ...
- ACM_“IP地址”普及(进制转换)
“IP地址”普及 Time Limit: 2000/1000ms (Java/Others) Problem Description: 大家都知道最近广财大校园网提速,现在就跟大家普及一下简单的互联网 ...
- ACM_小Z的A+B
小Z的A+B Time Limit: 2000/1000ms (Java/Others) Problem Description: 小Z最喜欢A+B了,没事就研究研究,比如什么大整数A+B(就是100 ...
- scala控制流程语句
直接上代码了哈. package com.test.scala.test object Kongzi { def main(args: Array[String]): Unit = { //if 语句 ...
- java_基础知识_字符串练习题_计算两个字符串的最长公共字串长度
package tek; Java算法——求出两个字符串的最长公共字符串 /** * @Title: 问题:有两个字符串str1和str2,求出两个字符串中最长公共字符串. * @author 匹夫( ...
- Android之Glide获取图片Path和Glide获取图片Bitmap
今天主要研究了Glide获取图片Path.Bitmap用法,相信也困扰了大家很久,我在网上也找了很久,基本没有,后来研究了下,也参考了下api文档,总结了以下几个方式: 1. 获取Bitmap: 1) ...
- Element type "LinearLayout" must be followed by either attribute specifications, ">" or "/>"的解决办法
看老师的word文档开始学习.复制了一段代码,在layout中新建了一个Android XML file,发现有提示错误. 代码如下: <?xml version="1.0" ...
- JS高级——apply与call
上下文调用模式 可以修改this的值,也就是可以修改函数的调用方式,apply.call可以修改函数调用上下文,也就是this的值 <script> var name = "莱昂 ...