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

127 lines
2.7 KiB

6 months ago
6 months ago
6 months ago
  1. <template>
  2. <view class="">
  3. <view class="tabbar-box"></view>
  4. <view class="tabbar">
  5. <view
  6. :class="{item : true, active : select == index}"
  7. v-for="(item, index) in list"
  8. :key="index"
  9. v-if="!item.isNotShop || !userShop"
  10. @click="toPath(item, index)">
  11. <view class="icon">
  12. <image :src="select == index ?
  13. item.selectedIconPath :
  14. item.iconPath" class="icon-image" mode=""></image>
  15. </view>
  16. <view class="title">
  17. {{ item.title }}
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import { mapGetters } from 'vuex'
  25. export default {
  26. name:"tabbar",
  27. props : ['select'],
  28. computed : {
  29. ...mapGetters(['userShop']),
  30. },
  31. data() {
  32. return {
  33. list : [
  34. {
  35. "selectedIconPath": "/static/image/tabbar/home-a.png",
  36. "iconPath": "/static/image/tabbar/home.png",
  37. "pagePath": "/pages/index/index",
  38. "title": "首页"
  39. },
  40. {
  41. "selectedIconPath": "/static/image/tabbar/category-a.png",
  42. "iconPath": "/static/image/tabbar/category.png",
  43. "pagePath": "/pages/index/category",
  44. "title": "分类",
  45. },
  46. // {
  47. // "selectedIconPath": "/static/image/tabbar/order-a.png",
  48. // "iconPath": "/static/image/tabbar/order.png",
  49. // "pagePath": "/pages/index/order",
  50. // "title": "订单中心"
  51. // },
  52. // {
  53. // "selectedIconPath": "/static/image/tabbar/cart-a.png",
  54. // "iconPath": "/static/image/tabbar/cart.png",
  55. // "pagePath": "/pages/index/cart",
  56. // "title": "购物车",
  57. // isNotShop : true,
  58. // },
  59. {
  60. "selectedIconPath": "/static/image/tabbar/center-a.png",
  61. "iconPath": "/static/image/tabbar/center.png",
  62. "pagePath": "/pages/index/center",
  63. "title": "个人中心"
  64. }
  65. ]
  66. };
  67. },
  68. methods : {
  69. toPath(item, index){
  70. if(index == this.select){
  71. return
  72. }
  73. uni.redirectTo({
  74. url: item.pagePath
  75. })
  76. },
  77. }
  78. }
  79. </script>
  80. <style scoped lang="scss">
  81. .tabbar-box{
  82. height: 120rpx;
  83. padding-bottom: env(safe-area-inset-bottom);
  84. }
  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: #BCBCBC;
  99. .item{
  100. flex: 1;
  101. display: flex;
  102. flex-direction: column;
  103. justify-content: center;
  104. align-items: center;
  105. .icon{
  106. width: 54rpx;
  107. height: 54rpx;
  108. .icon-image{
  109. width: 54rpx;
  110. height: 54rpx;
  111. }
  112. }
  113. .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. }
  123. .active{
  124. color: $uni-color !important;
  125. }
  126. </style>