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

125 lines
2.6 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <template>
  2. <view class="">
  3. <view class="tabbar-box"></view>
  4. <view class="tabbar">
  5. <view
  6. :class="{item : true, active : select == item.key}"
  7. v-for="(item, index) in list"
  8. :key="index"
  9. v-if="!item.isNotShop || !userShop"
  10. @click="toPath(item, index)">
  11. <view class="icon">
  12. <image :src="select == item.key ?
  13. item.selectedIconPath :
  14. item.iconPath" class="icon-image" mode=""></image>
  15. </view>
  16. <view class="title">
  17. {{ item.title }}
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import { mapGetters } from 'vuex'
  25. export default {
  26. name:"tabbar",
  27. props : ['select'],
  28. computed : {
  29. ...mapGetters(['userShop']),
  30. },
  31. data() {
  32. return {
  33. list : [
  34. {
  35. "selectedIconPath": "/static/image/tabbar/home-a.png",
  36. "iconPath": "/static/image/tabbar/home.png",
  37. "pagePath": "/pages/index/index",
  38. "title": "首页",
  39. key : 'home',
  40. },
  41. {
  42. "selectedIconPath": "/static/image/tabbar/zhaomu-a.png",
  43. "iconPath": "/static/image/tabbar/zhaomu.png",
  44. "pagePath": "/pages/index/member",
  45. "title": "招募",
  46. key : 'member',
  47. },
  48. {
  49. "selectedIconPath": "/static/image/tabbar/order-a.png",
  50. "iconPath": "/static/image/tabbar/order.png",
  51. "pagePath": "/pages/index/cart",
  52. "title": "订单",
  53. key : 'cart',
  54. },
  55. {
  56. "selectedIconPath": "/static/image/tabbar/center-a.png",
  57. "iconPath": "/static/image/tabbar/center.png",
  58. "pagePath": "/pages/index/center",
  59. "title": "我的",
  60. key : 'center',
  61. }
  62. ]
  63. };
  64. },
  65. methods : {
  66. toPath(item, index){
  67. if(item.key == this.select){
  68. return
  69. }
  70. uni.reLaunch({
  71. url: item.pagePath
  72. })
  73. },
  74. }
  75. }
  76. </script>
  77. <style scoped lang="scss">
  78. .tabbar-box{
  79. height: 120rpx;
  80. padding-bottom: env(safe-area-inset-bottom);
  81. }
  82. .tabbar{
  83. position: fixed;
  84. width: 750rpx;
  85. background-color: #1B1713;
  86. display: flex;
  87. justify-content: center;
  88. align-items: center;
  89. flex-direction: row;
  90. height: 120rpx;
  91. padding-bottom: env(safe-area-inset-bottom);
  92. z-index: 999999;
  93. bottom: 0;
  94. left: 0;
  95. color: #4C4C4C;
  96. border-radius: 67rpx 67rpx 0rpx 0rpx;
  97. .item{
  98. flex: 1;
  99. display: flex;
  100. flex-direction: column;
  101. justify-content: center;
  102. align-items: center;
  103. .icon{
  104. width: 54rpx;
  105. height: 54rpx;
  106. .icon-image{
  107. width: 54rpx;
  108. height: 54rpx;
  109. }
  110. }
  111. .title{
  112. overflow: hidden;
  113. white-space: nowrap;
  114. text-overflow: ellipsis;
  115. -o-text-overflow: ellipsis;
  116. font-size: 23rpx;
  117. line-height: 35rpx;
  118. }
  119. }
  120. }
  121. .active{
  122. color: #F85152 !important;
  123. }
  124. </style>