欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue mint-ui tabbar變組件使用

 更新時間:2018年05月04日 10:26:26   作者:wandoumm  
這篇文章主要介紹了vue mint-ui tabbar變組件使用方法及實例代碼,非常不錯具有參考借鑒價值,需要的朋友可以參考下

新建tabbar.vue

<template>
 <mt-tabbar v-model="message" fixed>
    <mt-tab-item id="MainPage">
      <img slot="icon" :src="this.atabs[0]">
      主頁
    </mt-tab-item>
    <mt-tab-item id="ShoppingList">
      <img slot="icon" v-bind:src="this.atabs[1]">
      積分商城
    </mt-tab-item>
    <mt-tab-item id="GroupList">
      <img slot="icon" v-bind:src="this.atabs[2]">
      微社區(qū)
    </mt-tab-item>
    <mt-tab-item id="UserCenter">
      <img slot="icon" v-bind:src="this.atabs[3]">
      我的
    </mt-tab-item>
  </mt-tabbar>
</template>
<script>
export default {
  data(){
    return{
    //選中的tabbar值message為外面頁面?zhèn)魅氲闹祍elected
      message:this.selected,
    //這里使用的icon圖標為圖片,所以需要加圖片改變的傳入,若使用阿里圖標,則不用加
      atabs:this.tabs,
    }
  },
  props:{
    selected: String,
    tabs:Array,
  },
  watch: {
    message: function (val, oldVal) {
      // 這里就可以通過 val 的值變更來確定去向
      switch(val){
        case 'MainPage':
          this.$router.push('/mainpage');
        break;
        case 'ShoppingList':
          this.$router.push('/shoppinglist');
        break;
        case 'GroupList':
          this.$router.push('/grouplist');
        break;
        case 'UserCenter':
          this.$router.push('/usercenter');
        break;
      }
    }
  },
}
</script>

在需要使用tabbar組件的頁面

引入組件

import tabbar from '../../components/tabbar'
export default {
  components:{tabbar},
  data(){
    return{
      selected:"ShoppingList",
      tabs:[require("../../assets/images/icon/zhuye.png"),require("../../assets/images/icon/icon42-1.png"),
         require("../../assets/images/icon/weuquan1.png"),require("../../assets/images/icon/huijia.png")],
     }
  },
}

html中

<tabbar :selected="selected" :tabs='tabs'></tabbar>

補充:

mint-ui —— tabbar示例

Import

按需引入:

import { Tabbar, TabItem } from 'mint-ui';
Vue.component(Tabbar.name, Tabbar);
Vue.component(TabItem.name, TabItem);

全局導入:全局導入后不用再導入

importMintfrom'mint-ui'
import'mint-ui/lib/style.css'
Vue.use(Mint);

總結(jié)

以上所述是小編給大家介紹的vue mint-ui tabbar變組件使用,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評論