| | |
| | | <template> |
| | | <view class="tab-bar"> |
| | | <u-tabbar :value="current ? current : 0" @change="tabbarchange" :fixed="true" :placeholder="false" :safeAreaInsetBottom="true" :border="true"> |
| | | <u-tabbar-item v-for="(item, index) in tabBarList" :key="index" :text="item.text"> |
| | | <image class="u-page__item__slot-icon" slot="active-icon" :src="item.selectedIconPath"></image> |
| | | <image class="u-page__item__slot-icon" slot="inactive-icon" :src="item.iconPath"></image> |
| | | <u-tabbar :value="current ? current : 0" |
| | | @change="tabbarchange" |
| | | :fixed="true" |
| | | :placeholder="false" |
| | | :safeAreaInsetBottom="true" |
| | | :border="true"> |
| | | <u-tabbar-item v-for="(item, index) in tabBarList" |
| | | :key="index" |
| | | :text="item.text"> |
| | | <image class="u-page__item__slot-icon" |
| | | slot="active-icon" |
| | | :src="item.selectedIconPath"></image> |
| | | <image class="u-page__item__slot-icon" |
| | | slot="inactive-icon" |
| | | :src="item.iconPath"></image> |
| | | </u-tabbar-item> |
| | | </u-tabbar> |
| | | </view> |
| | | </template> |
| | | <script> |
| | | import store from '@/store'; |
| | | export default { |
| | | props: { |
| | | current: Number |
| | | }, |
| | | created() { |
| | | uni.hideTabBar(); |
| | | }, |
| | | data() { |
| | | return { |
| | | // tabBarList: this.$store.state.userTabbar |
| | | }; |
| | | }, |
| | | computed: { |
| | | tabBarList() { |
| | | return this.$store.state.userTabbar; |
| | | import store from '@/store'; |
| | | export default { |
| | | props: { |
| | | current: Number |
| | | }, |
| | | created() { |
| | | uni.hideTabBar(); |
| | | }, |
| | | data() { |
| | | return { |
| | | // tabBarList: this.$store.state.userTabbar |
| | | }; |
| | | }, |
| | | computed: { |
| | | tabBarList() { |
| | | return this.$store.state.userTabbar; |
| | | } |
| | | }, |
| | | methods: { |
| | | tabbarchange(e) { |
| | | uni.switchTab({ |
| | | url: '/' + this.tabBarList[e].pagePath |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | tabbarchange(e) { |
| | | console.log(e, 'tab切换地址'); |
| | | uni.switchTab({ |
| | | url: '/' + this.tabBarList[e].pagePath |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | | }; |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | ::v-deep.tab-bar { |
| | | .u-tabbar { |
| | | &__content { |
| | | background: #ececec !important; |
| | | &__item-wrapper { |
| | | height: vww(50); |
| | | <style lang="scss" |
| | | scoped> |
| | | ::v-deep.tab-bar { |
| | | .u-tabbar { |
| | | &__content { |
| | | background: #ececec !important; |
| | | |
| | | &__item-wrapper { |
| | | height: vww(50); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .u-page__item__slot-icon { |
| | | width: vww(20) !important; |
| | | height: vww(20) !important; |
| | | } |
| | | </style> |
| | | .u-page__item__slot-icon { |
| | | width: vww(20) !important; |
| | | height: vww(20) !important; |
| | | } |
| | | </style> |