新建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]"> 微社区 </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为外面页面传入的值selected 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>
分享题目:vuemint-uitabbar变组件使用-创新互联
文章URL:https://www.cdcxhl.com/article24/ceopce.html
成都网站建设公司_创新互联,为您提供自适应网站、电子商务、域名注册、品牌网站设计、网站制作、ChatGPT
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联