建材商城系统20241014
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.

122 lines
2.6 KiB

7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months 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. export default {
  20. name: "tabbar",
  21. props: ['select'],
  22. computed: {
  23. },
  24. data() {
  25. return {
  26. list: [{
  27. "selectedIconPath": "/static/image/tabbar/home-a.png",
  28. "iconPath": "/static/image/tabbar/home.png",
  29. "pagePath": "/pages/index/index",
  30. "title": "首页",
  31. key: 'home',
  32. },
  33. {
  34. "selectedIconPath": "/static/image/tabbar/category-a.png",
  35. "iconPath": "/static/image/tabbar/category.png",
  36. "pagePath": "/pages/index/category",
  37. "title": "商品列表",
  38. key: 'category',
  39. },
  40. {
  41. "selectedIconPath": "/static/image/tabbar/cart-a.png",
  42. "iconPath": "/static/image/tabbar/cart.png",
  43. "pagePath": "/pages/index/cart",
  44. "title": "购物车",
  45. key: 'cart',
  46. },
  47. {
  48. "selectedIconPath": "/static/image/tabbar/center-a.png",
  49. "iconPath": "/static/image/tabbar/center.png",
  50. "pagePath": "/pages/index/center",
  51. "title": "我的",
  52. key: 'center',
  53. }
  54. ]
  55. };
  56. },
  57. methods: {
  58. toPath(item, index) {
  59. if (item.key == this.select) {
  60. return
  61. }
  62. uni.reLaunch({
  63. url: item.pagePath
  64. })
  65. },
  66. }
  67. }
  68. </script>
  69. <style scoped lang="scss">
  70. .tabbar-box {
  71. height: 120rpx;
  72. padding-bottom: env(safe-area-inset-bottom);
  73. .tabbar {
  74. position: fixed;
  75. width: 750rpx;
  76. background-color: #fff;
  77. display: flex;
  78. justify-content: center;
  79. align-items: center;
  80. flex-direction: row;
  81. height: 120rpx;
  82. padding-bottom: env(safe-area-inset-bottom);
  83. z-index: 999999;
  84. bottom: 0;
  85. left: 0;
  86. color: #BCBCBC;
  87. .tabbar-item {
  88. flex: 1;
  89. display: flex;
  90. flex-direction: column;
  91. justify-content: center;
  92. align-items: center;
  93. .tabbar-icon {
  94. width: 54rpx;
  95. height: 54rpx;
  96. .tabbar-icon-image {
  97. width: 54rpx;
  98. height: 54rpx;
  99. }
  100. }
  101. .tabbar-title {
  102. overflow: hidden;
  103. white-space: nowrap;
  104. text-overflow: ellipsis;
  105. -o-text-overflow: ellipsis;
  106. font-size: 23rpx;
  107. line-height: 35rpx;
  108. }
  109. }
  110. .tabbar-active {
  111. color: $uni-color !important;
  112. }
  113. }
  114. }
  115. </style>