1
1
<template >
2
2
<div class =" slideCharts" >
3
3
<div class =" chartBox" >
4
- <el-button @click =" setChartData(10)" >10天</el-button >
5
- <el-button @click =" setChartData(30)" >30天</el-button >
6
- <el-button @click =" setChartData(60)" >60天</el-button >
7
- <el-button @click =" setChartData(180)" >180天</el-button >
4
+ <div class =" btns" >
5
+ <el-button
6
+ :class =" { active: shows === 1 }"
7
+ size =" small"
8
+ @click ="
9
+ setChartData(10)
10
+ shows = 1
11
+ "
12
+ >10天</el-button
13
+ >
14
+ <el-button
15
+ :class =" { active: shows === 2 }"
16
+ size =" small"
17
+ @click ="
18
+ setChartData(30)
19
+ shows = 2
20
+ "
21
+ >30天</el-button
22
+ >
23
+ <el-button
24
+ :class =" { active: shows === 3 }"
25
+ size =" small"
26
+ @click ="
27
+ setChartData(60)
28
+ shows = 3
29
+ "
30
+ >60天</el-button
31
+ >
32
+ <el-button
33
+ :class =" { active: shows === 4 }"
34
+ size =" small"
35
+ @click ="
36
+ setChartData(180)
37
+ shows = 4
38
+ "
39
+ >180天</el-button
40
+ >
41
+ </div >
8
42
<div ref =" myCharts" class =" chartBox_d" ></div >
9
43
</div >
10
44
</div >
@@ -19,6 +53,7 @@ export default {
19
53
data () {
20
54
return {
21
55
mycharts: null ,
56
+ shows: 1 ,
22
57
date: [],
23
58
price: [],
24
59
chartData: {
@@ -136,10 +171,21 @@ export default {
136
171
box-shadow : 0 2px 12px 0 rgba (0 , 0 , 0 , 0.1 );
137
172
background : #fff ;
138
173
height : 100% ;
174
+ position : relative ;
139
175
.chartBox_d {
140
- height : 80 % ;
176
+ height : 100 % ;
141
177
box-sizing : border-box ;
142
178
padding : 30px 20px 30px 20px ;
143
179
}
180
+ .btns {
181
+ position : absolute ;
182
+ right : 40px ;
183
+ top : 20px ;
184
+ z-index : 99 ;
185
+ .el-button.active {
186
+ color : #3a8ee6 ;
187
+ background : #ddeeff ;
188
+ }
189
+ }
144
190
}
145
191
</style >
0 commit comments