<template>
<a class="m-tabbar-item" :class="{'is-active':isActive}" @click="goToRouter">
<div class="m-tabbar-item-icon" v-show="!isActive"><slot name="icon-normal"></slot></div>
<div class="m-tabbar-item-icon" v-show="isActive"><slot name="icon-active"></slot></div>
<div class="m-tabbar-item-text"><slot></slot></div>
</a>
</template>
<script type="text/ecmascript-6">
export default{
props: {
id: {
type: String
},
isRouter: {
type: Boolean,
default: false
}
},
computed: {
isActive () {
return this.isRouter
}
},
methods: {
goToRouter () {
this.$parent.$emit('tabbarActionEvent', this.id)
// 判断是否为路由跳转
this.$router.push(this.id)
}
}
}
</script>
<style scoped lang="stylus" rel="stylesheet/stylus">
.m-tabbar-item
flex: 1
text-align: center
.m-tabbar-item-icon
padding-top: 5px
padding-bottom 1px
img
width: 24px
height: 24px
.m-tabbar-item-text
font-size: 8px
color:#949494
&.is-active
.m-tabbar-item-text
color: #fa3e25
</style>
<template>
<div class="m-tabbar">
<slot></slot>
</div>
</template>
<script type="text/ecmascript-6">
export default {}
</script>
<style scoped lang="stylus" rel="stylesheet/stylus">
.m-tabbar
display: flex
flex-direction: row
position: fixed
bottom: 0
left: 0
right: 0
width: 100%
overflow: hidden
height: 50px
background: #fff
border-top: 1px solid #e4e4e4
</style>
<template>
<div id="app">
<router-view></router-view>
<m-tabbar @tabbarActionEvent='changeSelectedValue'>
<m-tabbar-item id='Home' :isRouter="isHome">


首页
</m-tabbar-item>
<m-tabbar-item id='Position' :isRouter="isPosition">


职位
</m-tabbar-item>
<m-tabbar-item id='Message' :isRouter="isMessage">


消息
</m-tabbar-item>
<m-tabbar-item id='Me' :isRouter="isMe">


我
</m-tabbar-item>
</m-tabbar>
</div>
</template>
<script>
import mTabbar from 'common/tab/tab.vue'
import mTabbarItem from 'common/tab/tabbar-item'
export default {
name: 'app',
components: {
mTabbar,
mTabbarItem
},
data () {
return {
isHome: true,
isPosition: false,
isMessage: false,
isMe: false
}
},
methods: {
changeSelectedValue: function (elValue) {
if (elValue === 'Home') {
this.isHome = true
} else {
this.isHome = false
}
if (elValue === 'Position') {
this.isPosition = true
} else {
this.isPosition = false
}
if (elValue === 'Message') {
this.isMessage = true
} else {
this.isMessage = false
}
if (elValue === 'Me') {
this.isMe = true
} else {
this.isMe = false
}
}
}
}
</script>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有