File tree 1 file changed +9
-5
lines changed
1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<button @click =" toggle" :class =" {checked:value}" > <span ></span > </button >
3
- <div >{{ value }}</div >
4
3
</template >
5
4
<script lang="ts">
6
5
export default {
@@ -24,10 +23,9 @@ button{
24
23
height : $h ;
25
24
width : $h * 2 ;
26
25
border : none ;
27
- background : grey ;
26
+ background : #bfbfbf ;
28
27
border-radius : $h / 2 ;
29
28
position : relative ;
30
- cursor : pointer ;
31
29
}
32
30
span {
33
31
position : absolute ;
@@ -37,15 +35,21 @@ span{
37
35
width : $h2 ;
38
36
background :white ;
39
37
border-radius : $h2 / 2 ;
40
- transition : left 250ms ;
38
+ transition : all 250ms ;
41
39
}
42
40
button .checked {
43
- background : #1989fa ;
41
+ background : #1890ff ;
44
42
}
45
43
button .checked > span {
46
44
left : calc (100% - #{$h2 } - 2px );
47
45
}
48
46
button :focus {
49
47
outline : none ;
50
48
}
49
+ button :active {
50
+ > span {width : $h2 + 4px ;}
51
+ }
52
+ button .checked :active {
53
+ > span {width : $h2 + 4px ; margin-left : -4px ;}
54
+ }
51
55
</style >
You can’t perform that action at this time.
0 commit comments