新建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圖標(biāo)為圖片,所以需要加圖片改變的傳入,若使用阿里圖標(biāo),則不用加
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>
分享題目:vuemint-uitabbar變組件使用-創(chuàng)新互聯(lián)
文章URL:http://chinadenli.net/article24/ceopce.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供自適應(yīng)網(wǎng)站、電子商務(wù)、域名注冊、品牌網(wǎng)站設(shè)計(jì)、網(wǎng)站制作、ChatGPT
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容