vue mint tabbar 组件 使用

原文链接: vue mint tabbar 组件 使用

上一篇: vue mint LoadMore 组件使用

下一篇: vue 自制tabbar 组件

网址

http://mint-ui.github.io/docs/#/zh-cn2/tabbar

底部选项卡,点击 tab 会切换显示的页面。依赖 tab-item 组件。

实现底部选项卡切换页面功能

230135_ea5U_2856757.png

是真滴方便。。。只需要设置图标和文字就行了,激活样式默认文字是蓝色,刚好和我的图标一样。。。

<template>
  <div class="container">
    <router-view class="router-view"></router-view>
    <mt-tabbar v-model="selected">
      <mt-tab-item v-for="i in tabs" :id="i.name" :key="i.name" @click.native="change(i)">
        <img slot="icon" :src="selected==i.name ? i.active : i.base">
        {{i.name}}
      </mt-tab-item>
    </mt-tabbar>
  </div>
</template>

<script>
  export default {
    name: "tab-mint",
    data() {
      return {
        selected: '订单',
        tabs: [
          {
            active: "/static/imgs/movie_active.png",
            base: "/static/imgs/movie_base.png",
            path: "/main/movie",
            name: '电影'
          },
          {
            active: "/static/imgs/comment_active.png",
            base: "/static/imgs/comment_base.png",
            path: "/main/review",
            name: '影评'
          },
          {
            active: "/static/imgs/collection_active.png",
            base: "/static/imgs/collection_base.png",
            path: "/main/collection/movie",
            name: '收藏'
          },
          {
            active: "/static/imgs/me_active.png",
            base: "/static/imgs/me_base.png",
            path: "/main/me",
            name: '我'
          },
        ]
      }
    },
    methods: {
      change(i) {
        console.log('i', i)
        this.$router.push(i.path)
      }
    }

  }
</script>

<style scoped>

  .container {
    width: 100vw;
    height: 100vh;

  }

  .router-view {
    width: 100%;
    height: 100%;
  }
</style>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值