1+ <template lang="jade">
2+ label
3+ input(type="checkbox", v-model="value", :disabled="disabled")
4+ span.label(:data-on="schema.textOn || 'On'", :data-off="schema.textOff || 'Off'")
5+ span.handle
6+ span {{ this | json}}
7+ </template >
8+
9+ <script >
10+ import abstractField from " ./abstractField" ;
11+
12+ export default {
13+ mixins: [ abstractField ]
14+ };
15+ </script >
16+
17+ <style lang="sass" scoped>
18+
19+ label {
20+ position : relative ;
21+ display : block ;
22+ vertical-align : top ;
23+ width : 100px ;
24+ height : 30px ;
25+ padding : 3px ;
26+ margin : 0 10px 10px 0 ;
27+ background : lin ear- gradient(to bottom , #eeeeee , #FFFFFF 25px );
28+ background-image : - webkit- lin ear- gradient(top , #eeeeee , #FFFFFF 25px );
29+ border-radius : 18px ;
30+ box-shadow : inset 0 -1px white , inset 0 1px 1px rgba(0 , 0 , 0 , 0.05 );
31+ cursor : pointer ;
32+ }
33+ input {
34+ position : absolute ;
35+ top : 0 ;
36+ left : 0 ;
37+ opacity : 0 ;
38+ }
39+ .label {
40+ position : relative ;
41+ display : block ;
42+ height : inherit ;
43+ font-size : 10px ;
44+ text-transform : uppercase ;
45+ background : #eceeef ;
46+ border-radius : inherit ;
47+ box-shadow : inset 0 1px 2px rgba(0 , 0 , 0 , 0.12 ), inset 0 0 2px rgba(0 , 0 , 0 , 0.15 );
48+ }
49+ .label :before , .label :after {
50+ position : absolute ;
51+ top : 50% ;
52+ margin-top : -.5em ;
53+ line-height : 1 ;
54+ -webkit-transition : inherit ;
55+ -moz-transition : inherit ;
56+ -o-transition : inherit ;
57+ transition : inherit ;
58+ }
59+ .label :before {
60+ content : attr (data-off );
61+ right : 11px ;
62+ color : #aaaaaa ;
63+ text-shadow : 0 1px rgba(255 , 255 , 255 , 0.5 );
64+ }
65+ .label :after {
66+ content : attr (data-on );
67+ left : 11px ;
68+ color : #FFFFFF ;
69+ text-shadow : 0 1px rgba(0 , 0 , 0 , 0.2 );
70+ opacity : 0 ;
71+ }
72+ input :checked ~ .label {
73+ background : #E1B42B ;
74+ box-shadow : inset 0 1px 2px rgba(0 , 0 , 0 , 0.15 ), inset 0 0 3px rgba(0 , 0 , 0 , 0.2 );
75+ }
76+ input :checked ~ .label :before {
77+ opacity : 0 ;
78+ }
79+ input :checked ~ .label :after {
80+ opacity : 1 ;
81+ }
82+
83+ .handle {
84+ position : absolute ;
85+ top : 4px ;
86+ left : 4px ;
87+ width : 28px ;
88+ height : 28px ;
89+ background : lin ear- gradient(to bottom , #FFFFFF 40% , #f0f0f0 );
90+ background-image : - webkit- lin ear- gradient(top , #FFFFFF 40% , #f0f0f0 );
91+ border-radius : 100% ;
92+ box-shadow : 1px 1px 5px rgba(0 , 0 , 0 , 0.2 );
93+ }
94+ .handle :before {
95+ content : " " ;
96+ position : absolute ;
97+ top : 50% ;
98+ left : 50% ;
99+ margin : -6px 0 0 -6px ;
100+ width : 12px ;
101+ height : 12px ;
102+ background : lin ear- gradient(to bottom , #eeeeee , #FFFFFF );
103+ background-image : - webkit- lin ear- gradient(top , #eeeeee , #FFFFFF );
104+ border-radius : 6px ;
105+ box-shadow : inset 0 1px rgba(0 , 0 , 0 , 0.02 );
106+ }
107+ input :checked ~ .handle {
108+ left : 74px ;
109+ box-shadow : -1px 1px 5px rgba(0 , 0 , 0 , 0.2 );
110+ }
111+
112+ /* Transition
113+ ========================== * /
114+ .label , .handle {
115+ transition : all 0.3s ease ;
116+ }
117+
118+ </style >
0 commit comments