index.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view class="bottom_tabbar">
  3. <view v-for="(item,index) in list" :key="index" @tap="changeTabbar(index)">
  4. <image :src="tabbarIndex===index?item.activeImg:item.inactiveImg"></image>
  5. <text :class="{'active':tabbarIndex===index}">{{item.text}}</text>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. props: {
  12. tabbarIndex: 0
  13. },
  14. data() {
  15. return {
  16. tabbarValue: 0,
  17. list: [
  18. {
  19. inactiveImg: this.$imgBase+'icon_home_grey.png',
  20. activeImg: this.$imgBase+'icon_home_blue.png',
  21. text: '首页',
  22. path: '/pagesHome/index'
  23. },
  24. {
  25. inactiveImg: this.$imgBase+'icon_xunjian_grey.png',
  26. activeImg: this.$imgBase+'icon_xunjian_blue.png',
  27. text: '智能巡检',
  28. path: '/pagesInspection/index'
  29. },
  30. {
  31. inactiveImg: this.$imgBase+'icon_storage_grey.png',
  32. activeImg: this.$imgBase+'icon_storage_blue.png',
  33. text: '仓储管理',
  34. path: '/pagesStorage/home'
  35. },
  36. ],
  37. loginSuccessUrl:''
  38. }
  39. },
  40. mounted() {
  41. this.tabbarValue = this.tabbarIndex;
  42. },
  43. methods: {
  44. changeTabbar(e) {
  45. this.tabbarValue = e;
  46. uni.reLaunch({
  47. url: this.list[e].path
  48. })
  49. }
  50. }
  51. }
  52. </script>
  53. <style scoped lang="less">
  54. .bottom_tabbar {
  55. width: 100%;
  56. height: 168rpx;
  57. background: #FFFFFF;
  58. display: flex;
  59. position: fixed;
  60. left: 0;
  61. bottom: 0;
  62. z-index: 999;
  63. padding-top: 10rpx;
  64. box-sizing: border-box;
  65. border-top: 1rpx solid lavender;
  66. &>view {
  67. width: calc(100% / 3);
  68. height: 100%;
  69. display: flex;
  70. flex-direction: column;
  71. align-items: center;
  72. image {
  73. width: 48rpx;
  74. height: 48rpx;
  75. }
  76. text {
  77. margin-top: 6rpx;
  78. font-family: PingFangSC, PingFang SC;
  79. font-weight: 400;
  80. font-size: 24rpx;
  81. color: #86909C;
  82. line-height: 33rpx;
  83. text-align: center;
  84. &.active{
  85. font-weight: bold;
  86. color: #198CFF;
  87. }
  88. }
  89. }
  90. }
  91. </style>