敢为人鲜小程序前端代码仓库
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.

123 lines
2.7 KiB

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