>  기사  >  웹 프론트엔드  >  Vue 홈페이지에서 하단 탐색 TabBar를 만드는 방법

Vue 홈페이지에서 하단 탐색 TabBar를 만드는 방법

php中世界最好的语言
php中世界最好的语言원래의
2018-03-07 09:38:072502검색

이번에는 Vue 홈페이지 하단 네비게이션 TabBar를 소개해 드리겠습니다. Vue 홈페이지 하단 네비게이션 TabBar 제작 시 주의사항은 무엇인가요? 실제 사례를 살펴보겠습니다.

<template>
  <div class="index">
  <div class="mainContent">
     <router-view></router-view>  
  </div>
   <div class="bottomBar">
      <ul>
       <li @click="toColor" > <router-link :to="{name:&#39;MapPlat&#39;}"> 
        ![](../assets/images/ic_map_nor@2x.png)![](../assets/images/ic_map@2x.png)        <p :class="{bottomBarColorActive:isColor}">展图</p></router-link></li>
       <li @click="toColor2"> <router-link :to="{name:&#39;Agenda&#39;}"> 
       ![](../assets/images/ic_yicheng_nor@2x.png)![](../assets/images/ic_yicheng@2x.png)       <p :class="{bottomBarColorActive:isColor2}">议程</p></router-link></li>
       <li @click="toColor3"> <router-link :to="{name:&#39;Recommend&#39;}">
        ![](../assets/images/ic_tuijian_nor@2x.png)![](../assets/images/ic_tuijian@2x.png)        <p :class="{bottomBarColorActive:isColor3}">推荐</p></router-link></li>
       <li @click="toColor4"> <router-link :to="{name:&#39;Attention&#39;}">
        ![](../assets/images/ic_guanzhu_nor@2x.png)
        ![](../assets/images/ic_guanzhu@2x.png)        <p :class="{bottomBarColorActive:isColor4}">关注</p></router-link></li>
       <li @click="toColor5"> <router-link :to="{name:&#39;Intro&#39;}"> 
       ![](../assets/images/ic_jianjie_nor@2x.png)
       ![](../assets/images/ic_jianjie@2x.png)       <p :class="{bottomBarColorActive:isColor5}">简介</p></router-link></li>
      </ul>
    </div>  
  </div></template><script>export default {  name: &#39;index&#39;,
  data () {    return {     isColor:true,     isColor2:false,     isColor3:false,     isColor4:false,     isColor5:false
    }
  },  methods:{    toColor:function(){      this.isColor=true;      this.isColor2=false;      this.isColor3=false;      this.isColor4=false;      this.isColor5=false;
    },        toColor2:function(){      this.isColor=false;      this.isColor2=true;      this.isColor3=false;      this.isColor4=false;      this.isColor5=false;
    },        toColor3:function(){      this.isColor=false;      this.isColor2=false;      this.isColor3=true;      this.isColor4=false;      this.isColor5=false;
    },        toColor4:function(){      this.isColor=false;      this.isColor2=false;      this.isColor3=false;      this.isColor4=true;      this.isColor5=false;
    },      toColor5:function(){      this.isColor=false;      this.isColor2=false;      this.isColor3=false;      this.isColor4=false;      this.isColor5=true;
    },
  }
}</script><!-- Add "scoped" attribute to limit CSS to this component only --><style scoped>.index {  height: 100%;
}.bottomBar {  height: 100px;  width: 100%;  border: 1px solid #ccc;  bottom: 0;  background: rgba(255,255,255,0.90);  position: fixed;  bottom: 0;
}.bottomBar ul {  display: flex;  width: 100%;  justify-content:space-around;
}.bottomBar  ul li {  /*width: 20%;*/}.bottomBar  ul li img {  margin: 8px 0;
}.bottomBar ul li p {  font-family: "PingFangSC-Regular";  font-size: 20px;  color: #D2D7E8;  letter-spacing: 0;  line-height: 20px;
}.mainContent {  height:-webkit-calc(100% - 100px);  height:-moz-calc(100% - 100px);  height:calc(100% - 100px);
}.bottomBarColorActive {  color: #4D81EE !important;
}</style>

이 사례를 읽으신 후 방법을 마스터하셨다고 생각합니다. 더 흥미로운 정보를 보려면 PHP 중국어 웹사이트의 다른 관련 기사를 주목하세요!

관련 읽기:

Video.js를 사용하여 H5 라이브 방송 인터페이스 구현

Jenkins+Node.js 지속적인 통합

위 내용은 Vue 홈페이지에서 하단 탐색 TabBar를 만드는 방법의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.