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

122 lines
2.5 KiB

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