diff --git a/src/form/switch.js b/src/form/switch.js index 93c50fe..ea9f41d 100644 --- a/src/form/switch.js +++ b/src/form/switch.js @@ -77,42 +77,20 @@ class Switch extends Component { // 尺寸 css` - @use 'sass:map'; - @use 'sass:math'; - $sizes: ( - s: ( - hd: 14px, - h: 20px, - f: 10px - ), - m: ( - hd: 16px, - h: 24px, - f: 12px - ), - xl: ( - hd: 20px, - h: 36px, - f: 14px - ) - ); + :host([size='small']) { + label { + height: 24px; + font-size: 12px; + } - @loop $s, $v in $sizes { - :host([size='#{$s}']) { - label { - height: map.get($v, 'h'); - font-size: math.max(map.get($v, 'f'), 12px); - } - - .switch { - min-width: map.get($v, 'hd') * 2 - 4; - height: map.get($v, 'hd'); - padding: 0 #{math.div((map.get($v, 'hd') - map.get($v, 'f')), 2)}; - } - .dot { - width: map.get($v, 'f'); - height: map.get($v, 'f'); - } + .switch { + min-width: 28px; + height: 16px; + padding: 0 2px; + } + .dot { + width: 12px; + height: 12px; } } `,