From 63f5fe3b0959385b8257ccb1eafc8de1c5573a8f Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Fri, 17 Mar 2023 11:25:38 +0800 Subject: [PATCH 1/2] feat(switch): update style for mobile --- docs/mobile/api_v2/switch.md | 10 ++- style/mobile/components/switch/v2/_index.less | 67 +++++++++---------- 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/docs/mobile/api_v2/switch.md b/docs/mobile/api_v2/switch.md index adc38318d6..f2afd3507c 100644 --- a/docs/mobile/api_v2/switch.md +++ b/docs/mobile/api_v2/switch.md @@ -16,8 +16,12 @@ toc: false 使用场景:需要通过描述解释、提示结果时,可用带描述开关 -{{ desc }} +{{ label }} -### 禁用状态 +### 组件状态 -{{ disabled }} +{{ status }} + +### 开关尺寸 + +{{ size }} \ No newline at end of file diff --git a/style/mobile/components/switch/v2/_index.less b/style/mobile/components/switch/v2/_index.less index f6953a8b51..24daff0b3b 100644 --- a/style/mobile/components/switch/v2/_index.less +++ b/style/mobile/components/switch/v2/_index.less @@ -6,6 +6,38 @@ display: flex; align-items: center; overflow: hidden; + vertical-align: middle; + width: @switch-width; + height: @switch-height; + border-radius: @switch-radius; + background-color: @switch-unchecked-color; + position: relative; + transition: all .3s ease; + overflow: hidden; + + &--checked { + background-color: @switch-checked-color; + } + + &--disabled { + background-color: @switch-unchecked-disabled-color; + } + + &--checked&--disabled { + background-color: @switch-checked-disabled-color; + } + + &--large { + width: @switch-large-width; + height: @switch-large-height; + border-radius: @switch-large-radius; + } + + &--small { + width: @switch-small-width; + height: @switch-small-height; + border-radius: @switch-small-radius; + } &__label { position: absolute; @@ -62,41 +94,6 @@ color: @switch-label-checked-color; } - &__body { - vertical-align: middle; - width: @switch-width; - height: @switch-height; - border-radius: @switch-radius; - background-color: @switch-unchecked-color; - position: relative; - transition: all .3s ease; - overflow: hidden; - - &--checked { - background-color: @switch-checked-color; - } - - &--disabled { - background-color: @switch-unchecked-disabled-color; - } - - &--checked&--disabled { - background-color: @switch-checked-disabled-color; - } - - &--large { - width: @switch-large-width; - height: @switch-large-height; - border-radius: @switch-large-radius; - } - - &--small { - width: @switch-small-width; - height: @switch-small-height; - border-radius: @switch-small-radius; - } - } - &__dot { position: absolute; left: @switch-dot-horizontal-margin; From 4c15fb14fbc7f03a01f0a118a0708f502e1264c5 Mon Sep 17 00:00:00 2001 From: leejimqiu Date: Fri, 17 Mar 2023 11:29:04 +0800 Subject: [PATCH 2/2] fix: resolve lint errors --- style/mobile/components/switch/v2/_index.less | 1 - 1 file changed, 1 deletion(-) diff --git a/style/mobile/components/switch/v2/_index.less b/style/mobile/components/switch/v2/_index.less index 24daff0b3b..201368ee26 100644 --- a/style/mobile/components/switch/v2/_index.less +++ b/style/mobile/components/switch/v2/_index.less @@ -5,7 +5,6 @@ .@{prefix}-switch { display: flex; align-items: center; - overflow: hidden; vertical-align: middle; width: @switch-width; height: @switch-height;