裂变星小程序-25.03.04
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.

119 lines
2.5 KiB

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