zoukankan      html  css  js  c++  java
  • vue 做的tabBar组件

    效果如下

    调用

    <tabbar :selected='selected'></tabbar>
    组件
    <template>
      <div class='tabbar'>
        <ul>
          <li @click="go(item.path)"
              :class="{active:message==item.path}"
              v-for="(item,index) in atabs">
            <img :src="message==item.path?item.icon_active:item.icon"
                 alt="">
            {{item.title}}
          </li>
        </ul>
      </div>
    </template>
    
    <script>
    export default {
      props: {
        selected: String,
      },
      name: 'tabbar',
      data () {
        return {
          message: this.selected,
          atabs: [
            { title: '首页', path: 'index', icon: require('@/assets/images/index.png'), icon_active: require('@/assets/images/index-active.png') },
            { title: '附近门店', path: 'storeLists', icon: require('@/assets/images/storeLists.png'), icon_active: require('@/assets/images/storeLists-active.png') },
            { title: '我的', path: 'gettheOrder', icon: require('@/assets/images/gettheOrder.png'), icon_active: require('@/assets/images/gettheOrder-active.png') }
          ]
        }
      },
      methods: {
        go (url) {
          this.$router.push(`/${url}`)
        }
      },
    }
    </script>
    <style lang="less" scoped>
    .tabbar {
      position: fixed;
      left: 0;
      bottom: 0;
       100%;
      height: 0.45rem;
      ul {
         100%;
        height: 100%;
        display: flex;
        justify-content: space-around;
        background-color: #fff;
        li {
          display: flex;
          flex-direction: column;
          justify-content: center;
           100%;
          text-align: center;
          // padding: 7px 0;
          border-top: 1px solid #eaeaea;
          font-size: 0.1rem;
          img {
             0.2rem;
            height: 0.2rem;
            margin: 5px auto 0px;
          }
          &.active {
            color: #ff5621;
            font-weight: bold;
          }
        }
      }
    }
    </style>
    

      

  • 相关阅读:
    归并排序法实现
    HuffmanTree
    快速排序法的实现
    随机数发生器说明
    装箱问题改进
    瞬间判断2的幂
    weblogic删除域
    【转】Mock方法介绍
    Oracle 11G空表无法导出处理
    深入理解JVM虚拟机(一):JVM运行时数据区
  • 原文地址:https://www.cnblogs.com/reaf/p/11180634.html
Copyright © 2011-2022 走看看