@@ -10,10 +10,7 @@ interface SwitchViewState {
10
10
checked : boolean ;
11
11
}
12
12
13
- export default class SwitchView extends React . Component <
14
- SwitchViewProps ,
15
- SwitchViewState
16
- > {
13
+ export default class SwitchView extends React . Component < SwitchViewProps , SwitchViewState > {
17
14
constructor ( props : SwitchViewProps ) {
18
15
super ( props ) ;
19
16
this . state = {
@@ -32,92 +29,45 @@ export default class SwitchView extends React.Component<
32
29
< Layout >
33
30
< Header title = { title } description = { description } />
34
31
< Body >
35
- < Card
36
- title = { `实例展示,value=${ this . state . checked } ` }
37
- bodyStyle = { { paddingLeft : 0 , paddingRight : 0 } } >
32
+ < Card title = { `实例展示,value=${ this . state . checked } ` } bodyStyle = { { paddingLeft : 0 , paddingRight : 0 } } >
38
33
< WingBlank >
39
- < Flex direction = "row" >
40
- < Switch
41
- checked = { this . state . checked }
42
- onValueChange = { this . handleChange }
43
- />
34
+ < Flex direction = "row" style = { { marginLeft : 15 } } >
35
+ < Switch checked = { this . state . checked } onValueChange = { this . handleChange } />
44
36
< Spacing type = "horizontal" />
45
- < Switch
46
- checked = { this . state . checked }
47
- onValueChange = { this . handleChange }
48
- />
37
+ < Switch checked = { this . state . checked } onValueChange = { this . handleChange } />
49
38
</ Flex >
50
39
</ WingBlank >
51
40
</ Card >
52
- < Card
53
- title = { '禁用无法切换,disabled={true}' }
54
- bodyStyle = { { paddingLeft : 0 , paddingRight : 0 } } >
41
+ < Card title = { '禁用无法切换,disabled={true}' } bodyStyle = { { paddingLeft : 0 , paddingRight : 0 } } >
55
42
< WingBlank >
56
- < Flex direction = "row" >
57
- < Switch
58
- checked = { this . state . checked }
59
- onValueChange = { this . handleChange }
60
- disabled
61
- />
43
+ < Flex direction = "row" style = { { marginLeft : 15 } } >
44
+ < Switch checked = { this . state . checked } onValueChange = { this . handleChange } disabled />
62
45
< Spacing type = "horizontal" />
63
- < Switch
64
- checked = { this . state . checked }
65
- onValueChange = { this . handleChange }
66
- disabled
67
- />
46
+ < Switch checked = { this . state . checked } onValueChange = { this . handleChange } disabled />
68
47
</ Flex >
69
48
</ WingBlank >
70
49
</ Card >
71
- < Card
72
- title = { '列表中展示,不受控组件' }
73
- bodyStyle = { { paddingLeft : 0 , paddingRight : 0 } }
74
- />
75
- < List
76
- flat = { false }
77
- extra = { < Switch style = { { position : 'absolute' , right : 0 } } /> } >
78
- < List . Item
79
- extra = {
80
- < Switch
81
- color = "red"
82
- checked
83
- style = { { position : 'absolute' , right : 0 } }
84
- />
85
- } >
86
- 自动设置
87
- </ List . Item >
88
- < List . Item
89
- extra = {
90
- < Switch
91
- color = "#2EA3F4"
92
- checked
93
- style = { { position : 'absolute' , right : 0 } }
94
- />
95
- } >
96
- 24小时制
97
- </ List . Item >
50
+ < Card title = { '列表中展示,不受控组件' } bodyStyle = { { paddingLeft : 0 , paddingRight : 0 } } />
51
+ < List flat = { false } extra = { < Switch style = { { position : 'absolute' , right : 0 } } /> } >
52
+ < List . Item extra = { < Switch color = "red" checked style = { { position : 'absolute' , right : 0 } } /> } > 自动设置</ List . Item >
53
+ < List . Item extra = { < Switch color = "#2EA3F4" checked style = { { position : 'absolute' , right : 0 } } /> } > 24小时制</ List . Item >
98
54
< List . Item > 12小时制</ List . Item >
99
55
</ List >
100
56
< Spacing />
101
- < Card
102
- title = { '设置颜色,color|trackStyle|thumbColor' }
103
- bodyStyle = { { paddingLeft : 0 , paddingRight : 0 } } >
57
+ < Card title = { '设置颜色,color|trackStyle|thumbColor' } bodyStyle = { { paddingLeft : 0 , paddingRight : 0 } } >
104
58
< WingBlank >
105
- < Flex direction = "row" >
59
+ < Flex direction = "row" style = { { marginLeft : 15 } } >
106
60
< Switch thumbColor = "#ffe9a6" />
107
61
< Spacing type = "horizontal" />
108
- < Switch
109
- trackStyle = { { backgroundColor : 'red' , borderColor : 'red' } }
110
- />
62
+ < Switch trackStyle = { { backgroundColor : 'red' , borderColor : 'red' } } />
111
63
< Spacing type = "horizontal" />
112
64
< Switch checked = { true } color = "#393E48" />
113
65
</ Flex >
114
66
</ WingBlank >
115
67
</ Card >
116
- < Card
117
- title = { "尺寸大小,size?: 'small' | 'default' | 'large';" }
118
- bodyStyle = { { paddingLeft : 0 , paddingRight : 0 } } >
68
+ < Card title = { "尺寸大小,size?: 'small' | 'default' | 'large';" } bodyStyle = { { paddingLeft : 0 , paddingRight : 0 } } >
119
69
< WingBlank >
120
- < Flex direction = "row" >
70
+ < Flex direction = "row" style = { { marginLeft : 15 } } >
121
71
< Switch size = "small" />
122
72
< Spacing type = "horizontal" />
123
73
< Switch />
@@ -126,11 +76,9 @@ export default class SwitchView extends React.Component<
126
76
</ Flex >
127
77
</ WingBlank >
128
78
</ Card >
129
- < Card
130
- title = { '尺寸大小,通过设置高宽来定制尺寸' }
131
- bodyStyle = { { paddingLeft : 0 , paddingRight : 0 } } >
79
+ < Card title = { '尺寸大小,通过设置高宽来定制尺寸' } bodyStyle = { { paddingLeft : 0 , paddingRight : 0 } } >
132
80
< WingBlank >
133
- < Flex direction = "row" >
81
+ < Flex direction = "row" style = { { marginLeft : 15 } } >
134
82
< Switch style = { { height : 23 , width : 34 } } />
135
83
< Spacing type = "horizontal" />
136
84
< Switch style = { { height : 28 , width : 42 } } />
0 commit comments