珠宝小程序前端代码
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.

126 lines
2.7 KiB

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