From 26543e89ebb4861db5571fc8ee96af9e020ba339 Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 10 Apr 2019 16:45:30 +0800 Subject: [PATCH] [improvement] Slider: add less vars (#3125) --- packages/slider/index.less | 16 ++++++++-------- packages/style/var.less | 10 ++++++++++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/packages/slider/index.less b/packages/slider/index.less index c9ae76478..37340589a 100644 --- a/packages/slider/index.less +++ b/packages/slider/index.less @@ -3,20 +3,20 @@ .van-slider { position: relative; border-radius: 999px; - background-color: @gray-light; + background-color: @slider-inactive-background-color; &__bar { position: relative; border-radius: inherit; - background-color: @blue; + background-color: @slider-active-background-color; } &__button { - width: 20px; - height: 20px; - border-radius: 50%; - background-color: @white; - box-shadow: 0 1px 2px rgba(0, 0, 0, .5); + width: @slider-button-width; + height: @slider-button-height; + box-shadow: @slider-button-box-shadow; + border-radius: @slider-button-border-radius; + background-color: @slider-button-background-color; &-wrapper { position: absolute; @@ -37,7 +37,7 @@ } &--disabled { - opacity: .3; + opacity: @slider-disabled-opacity; } &--vertical { diff --git a/packages/style/var.less b/packages/style/var.less index 5eb7e33d4..3306e35d0 100644 --- a/packages/style/var.less +++ b/packages/style/var.less @@ -186,6 +186,16 @@ @radio-disabled-label-color: @gray; @radio-disabled-background-color: @border-color; +// Slider +@slider-active-background-color: @blue; +@slider-inactive-background-color: @gray-light; +@slider-disabled-opacity: .3; +@slider-button-width: 20px; +@slider-button-height: 20px; +@slider-button-border-radius: 50%; +@slider-button-background-color: @white; +@slider-button-box-shadow: 0 1px 2px rgba(0, 0, 0, .5); + // Swipe @swipe-indicator: 6px;