爱简收旧衣按件回收前端代码仓库
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.

118 lines
2.4 KiB

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