tabs.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <view class="tab-title">
  3. <view class="tab-title">
  4. <view class="tab_box rx-sc">
  5. <view class="tab_item" v-for="(item, index) in tabList" :key="index" v-text="item.label"
  6. :class="{active: pickTabIndex == index}" @click="changeChartsTab(index)"></view>
  7. </view>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. data() {
  14. return {
  15. pickTabIndex: 0,
  16. tabList: [{
  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. display: flex;
  47. align-items: center;
  48. background-color: #fff;
  49. position: relative;
  50. .tab_box {
  51. width: 100%;
  52. height: 68rpx;
  53. position: relative;
  54. }
  55. .tab_item {
  56. height: 68rpx;
  57. line-height: 68rpx;
  58. padding: 0 20rpx;
  59. font-size: 32rpx;
  60. // color: #979C9E;
  61. }
  62. .active {
  63. box-sizing: border-box;
  64. border-bottom: 6rpx solid $theme-color;
  65. color: $theme-color;
  66. }
  67. }
  68. </style>