tabs.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <view class="tab-title">
  3. <view v-for="(item, index) in tabList" :key="index" class="tab-item" v-text="item.label" :class="index === pickTabIndex ? 'active' : ''" @click="changeChartsTab(index)"></view>
  4. <view class="search-icon" @click="$emit('handleSearch')">
  5. 筛选
  6. <image src="~@/static/filter.svg" mode=""></image>
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. export default {
  12. data() {
  13. return {
  14. pickTabIndex: 0,
  15. tabList: [
  16. {
  17. value: '',
  18. label: '全部'
  19. },
  20. {
  21. value: 0,
  22. label: '待审核'
  23. },
  24. {
  25. value: 1,
  26. label: '审核中'
  27. },
  28. {
  29. value: 2,
  30. label: '已审核'
  31. }
  32. ]
  33. }
  34. },
  35. methods: {
  36. //切换tab
  37. changeChartsTab(index) {
  38. this.pickTabIndex = index
  39. this.$emit('change', this.tabList[index].value)
  40. }
  41. }
  42. }
  43. </script>
  44. <style lang="scss" scoped>
  45. .tab-title {
  46. width: 100%;
  47. display: flex;
  48. justify-content: space-between;
  49. align-items: center;
  50. height: $tab-height;
  51. line-height: $tab-height;
  52. background-color: #ffffff;
  53. border-bottom: 1px solid #f2f2f2;
  54. box-sizing: border-box;
  55. .search-icon {
  56. display: flex;
  57. align-items: center;
  58. justify-content: space-around;
  59. font-size: 28rpx;
  60. white-space: nowrap;
  61. margin-left: 10rpx;
  62. image {
  63. width: 30rpx;
  64. height: 30rpx;
  65. }
  66. }
  67. .tab-item {
  68. width: 25%;
  69. text-align: center;
  70. font-size: 32rpx;
  71. color: $uni-text-color-grey;
  72. }
  73. .tab-item.active {
  74. color: $j-primary-border-green;
  75. border-bottom: 1px solid $j-primary-border-green;
  76. font-weight: bold;
  77. }
  78. .tab-item.filter {
  79. flex: 1;
  80. padding: 0px 30rpx;
  81. .uni-icons {
  82. display: flex;
  83. padding-top: 5px;
  84. }
  85. }
  86. }
  87. </style>