tabs.vue 1.8 KB

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