commit | author | age
|
9dfbe6
|
1 |
<template> |
CM |
2 |
<ul> |
|
3 |
<li :class="{ active: activeOption === 'poor' }"> |
|
4 |
<button type="button" @click="activate('poor')">Poor</button> |
|
5 |
</li> |
|
6 |
<li :class="{ active: activeOption === 'average' }"> |
|
7 |
<button type="button" @click="activate('average')">Average</button> |
|
8 |
</li> |
|
9 |
<li :class="{ active: activeOption === 'great' }"> |
|
10 |
<button type="button" @click="activate('great')">Great</button> |
|
11 |
</li> |
|
12 |
</ul> |
|
13 |
</template> |
|
14 |
|
|
15 |
<script>export default { |
|
16 |
data() { |
|
17 |
return { |
|
18 |
activeOption: null, |
|
19 |
}; |
|
20 |
}, |
|
21 |
methods: { |
|
22 |
activate(option) { |
|
23 |
this.activeOption = option; |
|
24 |
} |
|
25 |
} |
|
26 |
|
|
27 |
} |
|
28 |
</script> |
|
29 |
|
|
30 |
<style scoped> |
|
31 |
.active { |
|
32 |
border-color: purple; |
|
33 |
} |
|
34 |
|
|
35 |
.active button { |
|
36 |
color: purple; |
|
37 |
} |
|
38 |
|
|
39 |
ul { |
|
40 |
list-style: none; |
|
41 |
margin: 0.5rem 0; |
|
42 |
padding: 0; |
|
43 |
display: flex; |
|
44 |
} |
|
45 |
|
|
46 |
li { |
|
47 |
margin: 0 1rem; |
|
48 |
border: 1px solid #ccc; |
|
49 |
padding: 1rem; |
|
50 |
display: flex; |
|
51 |
align-items: center; |
|
52 |
} |
|
53 |
|
|
54 |
button { |
|
55 |
font: inherit; |
|
56 |
border: none; |
|
57 |
background-color: transparent; |
|
58 |
cursor: pointer; |
|
59 |
} |
|
60 |
</style> |