ali
2025-01-13 2f2b09869423f7e98c64f79dc96c62d9a1696f24
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<template>
  <div class="header">
    <slot></slot>
    <div class="btn-list" v-if="props.showBtn">
      <div
        class="btn-list-item"
        :class="{ active: timeType == dict.value }"
        v-for="dict in props.period"
        :key="dict.value"
        @click="handleClick(dict.value)"
      >
        {{ dict.label }}
      </div>
    </div>
  </div>
</template>
 
<script setup>
const emit = defineEmits()
const props = defineProps(["showBtn", "period", "active"])
const data = reactive({
  timeType: "DAY",
})
const { timeType } = toRefs(data)
handleClick(timeType.value)
 
function handleClick(value) {
  timeType.value = value
  emit("handleClick", timeType.value, props.active)
}
</script>
 
<style lang="scss" scoped>
.themeDark {
  .header {
    // width: 88px;
    height: 26px;
    font-family: OPPOSans, OPPOSans;
    font-weight: bold;
    font-size: 18px;
    color: #fffefe;
    line-height: 29px;
    text-align: left;
    font-style: normal;
    text-transform: none;
    display: flex;
    justify-content: space-between;
 
    .btn-list {
      display: flex;
 
      .btn-list-item {
        width: 46px;
        height: 32px;
        line-height: 32px;
        background: #3041ab;
        font-family: OPPOSans, OPPOSans;
        text-align: center;
        font-weight: 500;
        font-size: 14px;
        color: #5996f9;
        cursor: pointer;
      }
 
      :first-child {
        border-radius: 4px 0px 0px 4px;
      }
 
      :last-child {
        border-radius: 0px 4px 4px 0px;
      }
 
      .active {
        background: #1d6aff;
        color: #fff;
      }
    }
  }
}
 
.themeLight {
  .header {
    // width: 88px;
    height: 26px;
    font-family: OPPOSans, OPPOSans;
    font-weight: bold;
    font-size: 18px;
    color: #000;
    line-height: 29px;
    text-align: left;
    font-style: normal;
    text-transform: none;
    display: flex;
    justify-content: space-between;
 
    .btn-list {
      display: flex;
 
      .btn-list-item {
        width: 46px;
        height: 32px;
        line-height: 32px;
        background: #f7f8fa;
        font-family: OPPOSans, OPPOSans;
        text-align: center;
        font-weight: 500;
        font-size: 14px;
        color: #5996f9;
        cursor: pointer;
      }
 
      :first-child {
        border-radius: 4px 0px 0px 4px;
      }
 
      :last-child {
        border-radius: 0px 4px 4px 0px;
      }
 
      .active {
        background: #1d6aff;
        color: #fff;
      }
    }
  }
}
</style>