| | |
| | | <view> |
| | | <u-tabbar class="custom-tabbar" zIndex="100" :value="currentTab" :fixed="true" :active-color="activeColor" |
| | | :inactive-color="inactiveColor" @change='change'> |
| | | <u-tabbar-item v-for="(item,index) in curTabList" :key="index" :text="item.name" |
| | | :badge="item.badge>0?item.badge:0"> |
| | | <image class="u-page_item_slot_icon" slot="active-icon" :src="item.iconPathSelected" /> |
| | | <image class="u-page_item_slot_icon" slot="inactive-icon" :src="item.iconPath" /> |
| | | <u-tabbar-item v-for="(item,index) in curTabList" :icon="item.icon" :key="index" :text="item.name"> |
| | | </u-tabbar-item> |
| | | </u-tabbar> |
| | | </view> |
| | |
| | | export default { |
| | | props: { |
| | | currentTab: {}, |
| | | tabList: { |
| | | type: Array, |
| | | default: () => [] |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | inactiveColor: '#909399', |
| | | activeColor: '#328CFA', |
| | | //10分钟 |
| | | getMessageTime: 1000 * 60 * 10, |
| | | |
| | | curTabList: [ |
| | | { |
| | | |
| | | |
| | | curTabList: [{ |
| | | name: '首页', |
| | | iconPathSelected: '', |
| | | iconPath: '', |
| | | icon: "home", |
| | | url: '/pages/home/index' |
| | | }, |
| | | { |
| | | name: '个人中心', |
| | | iconPathSelected: '', |
| | | iconPath: '', |
| | | icon: "account-fill", |
| | | url: '/pages/user/center' |
| | | } |
| | | ] |
| | |
| | | // this.getMessage() |
| | | }, |
| | | destroyed() { |
| | | this.$intv && clearInterval(this.$intv) |
| | | this.$intv = null |
| | | |
| | | }, |
| | | methods: { |
| | | change(e) { |
| | |
| | | this.$u.func.updateTabbar(res.data) |
| | | }) |
| | | }, |
| | | |
| | | getMessage() { |
| | | let params = { |
| | | recipient: this.userInfo.user_id, |
| | | status: 0 |
| | | } |
| | | |
| | | messageCount(params).then(res => { |
| | | this.$u.func.updateTabbar(res.data) |
| | | }) |
| | | |
| | | this.$intv = setInterval(() => { |
| | | let params = { |
| | | recipient: this.userInfo.user_id, |
| | | status: 0 |
| | | } |
| | | messageCount(params).then(res => { |
| | | this.$u.func.updateTabbar(res.data) |
| | | }) |
| | | }, this.getMessageTime) |
| | | } |
| | | |
| | | } |
| | | } |