en-tab.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view class="tab-box sys-background-fff">
  3. <view class="tab-item " :class="{'tab-check':tabIndex==index}" @click="setTab(item.path,index)"
  4. v-for="(item,index) in tabList" :key="index">
  5. <view class="tab-content">
  6. <image class="tab-img"
  7. :src="`/static/img/tabBar/${tabIndex==index?item.selectedIconPath:item.iconPath}.png`"></image>
  8. <view class="tab-text sys-size-24 text-color-dominant">{{item.name}}</view>
  9. </view>
  10. </view>
  11. <!-- <view class="tab-item" :class="{'tab-check':tabIndex===2}" @click="setTab(2)">
  12. <view class="tab-content">
  13. <image v-if="tabIndex===2" class="tab-img" src="/static/img/tabBar/task-select.png"></image>
  14. <image v-else class="tab-img" src="/static/img/tabBar/task-default.png"></image>
  15. <view class="tab-text sys-size-24 text-color-dominant">任务</view>
  16. </view>
  17. </view>
  18. <view class="tab-item" :class="{'tab-check':tabIndex===3}" @click="setTab(3)">
  19. <view class="tab-content">
  20. <image v-if="tabIndex===3" class="tab-img" src="/static/img/tabBar/loan-select.png"></image>
  21. <image v-else class="tab-img" src="/static/img/tabBar/loan-default.png"></image>
  22. <view class="tab-text sys-size-24 text-color-dominant ">贷后</view>
  23. </view>
  24. </view>
  25. <view class="tab-item" :class="{'tab-check':tabIndex===4}" @click="setTab(3)">
  26. <view class="tab-content">
  27. <image v-if="tabIndex===4" class="tab-img" src="/static/img/tabBar/statistics-select.png"></image>
  28. <image v-else class="tab-img" src="/static/img/tabBar/statistics-default.png"></image>
  29. <view class="tab-text sys-size-24 text-color-dominant ">统计</view>
  30. </view>
  31. </view> -->
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. name: 'en-tab',
  37. props: {
  38. 'tabIndex': {
  39. default: 0
  40. }
  41. },
  42. data() {
  43. return {
  44. tabList: [{
  45. name: '工作台',
  46. path: '/pages/index/index',
  47. iconPath: 'home-default',
  48. selectedIconPath: 'home-select',
  49. },
  50. {
  51. name: '任务',
  52. path: '/pages/task/task',
  53. iconPath: 'task-default',
  54. selectedIconPath: 'task-select',
  55. },
  56. {
  57. name: '贷后',
  58. path: '/pages/loan/loan',
  59. iconPath: 'loan-default',
  60. selectedIconPath: 'loan-select',
  61. },
  62. {
  63. name: '统计',
  64. path: '/pages/statistics/statistics',
  65. iconPath: 'statistics-default',
  66. selectedIconPath: 'statistics-select',
  67. },
  68. ]
  69. };
  70. },
  71. methods: {
  72. setTab(path) {
  73. uni.switchTab({
  74. url: path
  75. })
  76. }
  77. },
  78. }
  79. </script>
  80. <style lang="scss">
  81. .tab-box {
  82. display: flex;
  83. justify-content: space-between;
  84. height: 120rpx;
  85. padding-bottom: 14rpx;
  86. position: fixed;
  87. bottom: 0;
  88. padding-bottom: env(safe-area-inset-bottom);
  89. width: 100%;
  90. .tab-item {
  91. width: 25%;
  92. display: flex;
  93. justify-content: center;
  94. .tab-content {
  95. padding-top: 25rpx;
  96. width: 108rpx;
  97. height: 130rpx;
  98. box-sizing: border-box;
  99. border-radius: 0 0 100rpx 100rpx;
  100. text-align: center;
  101. .tab-img {
  102. width: 42rpx;
  103. height: 42rpx;
  104. }
  105. .tab-text {
  106. font-weight: 400;
  107. line-height: 34rpx;
  108. color: #333333;
  109. }
  110. }
  111. }
  112. .tab-check {
  113. .tab-content {
  114. background-color: rgba(15, 177, 128, 0.1);
  115. .tab-text {
  116. font-weight: 500;
  117. color: #0FB180;
  118. }
  119. }
  120. }
  121. }
  122. </style>