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

115 lines
2.4 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
  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/center-a.png",
  42. "iconPath": "/static/image/tabbar/center.png",
  43. "pagePath": "/pages/index/center",
  44. "title": "我的",
  45. key: 'center',
  46. }
  47. ]
  48. };
  49. },
  50. methods: {
  51. toPath(item, index) {
  52. if (item.key == this.select) {
  53. return
  54. }
  55. uni.reLaunch({
  56. url: item.pagePath
  57. })
  58. },
  59. }
  60. }
  61. </script>
  62. <style scoped lang="scss">
  63. .tabbar-box {
  64. height: 120rpx;
  65. padding-bottom: env(safe-area-inset-bottom);
  66. .tabbar {
  67. position: fixed;
  68. width: 750rpx;
  69. background-color: #fff;
  70. display: flex;
  71. justify-content: center;
  72. align-items: center;
  73. flex-direction: row;
  74. height: 120rpx;
  75. padding-bottom: env(safe-area-inset-bottom);
  76. z-index: 999999;
  77. bottom: 0;
  78. left: 0;
  79. color: #BCBCBC;
  80. .tabbar-item {
  81. flex: 1;
  82. display: flex;
  83. flex-direction: column;
  84. justify-content: center;
  85. align-items: center;
  86. .tabbar-icon {
  87. width: 54rpx;
  88. height: 54rpx;
  89. .tabbar-icon-image {
  90. width: 54rpx;
  91. height: 54rpx;
  92. }
  93. }
  94. .tabbar-title {
  95. overflow: hidden;
  96. white-space: nowrap;
  97. text-overflow: ellipsis;
  98. -o-text-overflow: ellipsis;
  99. font-size: 23rpx;
  100. line-height: 35rpx;
  101. }
  102. }
  103. .tabbar-active {
  104. color: $uni-color !important;
  105. }
  106. }
  107. }
  108. </style>