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.

73 lines
1.6 KiB

7 months ago
  1. <template>
  2. <view class="tabBox">
  3. <view class="tabs">
  4. <view class="tab" @click="tabClick(1)" :class="{active: currentTab==1}">按日</view>
  5. <view class="tab" @click="tabClick(2)" :class="{active: currentTab==2}">按月</view>
  6. <!-- <view class="tab" @click="tabClick(3)" :class="{active: currentTab==3}">按年</view> -->
  7. <!-- <view class="tab long" @click="tabClick(4)" :class="{active: currentTab==4}">{{ customDate }}</view> -->
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. data() {
  14. return {
  15. currentTab: 1,
  16. showDatePicker: false,
  17. customDate: '自定义日期'
  18. }
  19. },
  20. mounted() {
  21. let numDate = this.$u.utils.getCustomDay(-7)
  22. console.log(numDate)
  23. },
  24. methods: {
  25. tabClick(num) {
  26. this.currentTab = num
  27. if(num==4) {
  28. this.showDatePicker = true
  29. }
  30. },
  31. // 2选择时间选择器里的时间
  32. selectDateClick(val) {
  33. if(val.date1) {
  34. this.customDate = val.date1
  35. }else {
  36. this.customDate = val.date2+ '至' + val.date3
  37. }
  38. this.showDatePicker = false
  39. }
  40. }
  41. }
  42. </script>
  43. <style lang="scss" scoped>
  44. .tabs {
  45. display: flex;
  46. // justify-content: space-between;
  47. padding-bottom: 24rpx;
  48. .tab {
  49. width: 96rpx;
  50. height: 60rpx;
  51. background: rgba(25, 137, 250, 0.1);
  52. border-radius: 8rpx;
  53. border: 2rpx solid #1989FA;
  54. font-size: 28rpx;
  55. text-align: center;
  56. line-height: 60rpx;
  57. color: $themC;
  58. margin-right: 30rpx;
  59. &.active {
  60. color: #fff;
  61. background-color: $themC;
  62. }
  63. &.long {
  64. min-width: 336rpx;
  65. width: fit-content !important;
  66. }
  67. }
  68. }
  69. </style>