鸿宇研学生前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
2.9 KiB

3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
  1. <template>
  2. <view class="tabbar-box">
  3. <view class="tabbar">
  4. <view :class="{ 'tabbar-active' : select == item.key}" v-for="(item, index) in list" :key="index"
  5. v-if="!item.isNotShop || !userShop" @click="toPath(item, index)" class="tabbar-item">
  6. <view class="tabbar-icon">
  7. <image :src="select == item.key ?
  8. item.selectedIconPath :
  9. item.iconPath" class="tabbar-icon-image" mode="aspectFill"></image>
  10. </view>
  11. <view class="tabbar-title">
  12. {{ item.title }}
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import {
  20. mapGetters
  21. } from 'vuex'
  22. export default {
  23. name: "tabbar",
  24. props: ['select'],
  25. computed: {
  26. ...mapGetters(['userShop']),
  27. },
  28. data() {
  29. return {
  30. list: [
  31. {
  32. "selectedIconPath": "/static/image/tabbar/home-active.png",
  33. "iconPath": "/static/image/tabbar/home.png",
  34. "pagePath": "/pages/index/index",
  35. "title": "首页",
  36. key: 'home',
  37. },
  38. {
  39. "selectedIconPath": "/static/image/tabbar/category-active.png",
  40. "iconPath": "/static/image/tabbar/category.png",
  41. "pagePath": "/pages/index/category",
  42. "title": "分类",
  43. key: 'category',
  44. },
  45. {
  46. "selectedIconPath": "/static/image/tabbar/growing-active.png",
  47. "iconPath": "/static/image/tabbar/growing.png",
  48. "pagePath": "/pages/index/growing",
  49. "title": "成长档案",
  50. key: 'growing',
  51. },
  52. {
  53. "selectedIconPath": "/static/image/tabbar/partner-active.png",
  54. "iconPath": "/static/image/tabbar/partner.png",
  55. "pagePath": "/pages/index/partner",
  56. "title": "合伙人",
  57. key: 'partner',
  58. },
  59. {
  60. "selectedIconPath": "/static/image/tabbar/user-center-active.png",
  61. "iconPath": "/static/image/tabbar/user-center.png",
  62. "pagePath": "/pages/index/center",
  63. "title": "我的",
  64. key: 'center',
  65. },
  66. ]
  67. };
  68. },
  69. methods: {
  70. toPath(item, index) {
  71. if (item.key == this.select) {
  72. return
  73. }
  74. uni.reLaunch({
  75. url: item.pagePath
  76. })
  77. },
  78. }
  79. }
  80. </script>
  81. <style scoped lang="scss">
  82. .tabbar-box {
  83. height: 120rpx;
  84. padding-bottom: env(safe-area-inset-bottom);
  85. .tabbar {
  86. position: fixed;
  87. width: 750rpx;
  88. background-color: #fff;
  89. display: flex;
  90. justify-content: center;
  91. align-items: center;
  92. flex-direction: row;
  93. height: 120rpx;
  94. padding-bottom: env(safe-area-inset-bottom);
  95. z-index: 999999;
  96. bottom: 0;
  97. left: 0;
  98. color: #999999;
  99. .tabbar-item {
  100. flex: 1;
  101. display: flex;
  102. flex-direction: column;
  103. justify-content: center;
  104. align-items: center;
  105. .tabbar-icon {
  106. width: 54rpx;
  107. height: 54rpx;
  108. .tabbar-icon-image {
  109. width: 54rpx;
  110. height: 54rpx;
  111. }
  112. }
  113. .tabbar-title {
  114. overflow: hidden;
  115. white-space: nowrap;
  116. text-overflow: ellipsis;
  117. -o-text-overflow: ellipsis;
  118. font-size: 23rpx;
  119. line-height: 35rpx;
  120. }
  121. }
  122. .tabbar-active {
  123. color: #181818 !important;
  124. }
  125. }
  126. }
  127. </style>