推拿小程序前端代码仓库
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.

130 lines
2.7 KiB

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