[improvement] Checkbox: update disabled label color (#2260)

This commit is contained in:
neverland 2018-12-10 20:25:13 +08:00 committed by GitHub
parent 4fe387b7b1
commit abee937da9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 16 deletions

View File

@ -18,11 +18,11 @@
color: transparent;
text-align: center;
line-height: inherit;
border: 1px solid @gray-light;
width: @checkbox-size;
height: @checkbox-size;
box-sizing: border-box;
transition: .2s;
border: 1px solid @checkbox-border-color;
transition: @checkbox-transition-duration;
}
&--round {
@ -34,33 +34,36 @@
&--checked {
.van-icon {
color: @white;
border-color: @blue;
background-color: @blue;
border-color: @checkbox-checked-icon-color;
background-color: @checkbox-checked-icon-color;
}
}
&--disabled {
.van-icon {
color: @background-color;
border-color: @border-color;
background-color: currentColor;
border-color: @checkbox-disabled-icon-color;
background-color: @checkbox-disabled-background-color;
}
}
&--disabled&--checked {
.van-icon {
border-color: @border-color;
background-color: @border-color;
color: @checkbox-disabled-icon-color;
}
}
}
&__label {
margin-left: 10px;
color: @checkbox-label-color;
margin-left: @checkbox-label-margin;
&--left {
float: left;
margin: 0 10px 0 0;
margin: 0 @checkbox-label-margin 0 0;
}
&--disabled {
color: @checkbox-disabled-label-color;
}
}
}

View File

@ -1,7 +1,7 @@
<template>
<div :class="b()">
<div
:class="[b('icon', [shape, { disabled: isDisabled, checked }])]"
:class="b('icon', [shape, { disabled: isDisabled, checked }])"
@click="toggle"
>
<slot
@ -16,7 +16,7 @@
</div>
<span
v-if="$slots.default"
:class="b('label', labelPosition)"
:class="b('label', [labelPosition, { disabled: isDisabled }])"
@click="toggle('label')"
>
<slot />

View File

@ -18,7 +18,7 @@ exports[`renders demo correctly 1`] = `
<!---->
<!---->
</i>
</div> <span class="van-checkbox__label">
</div> <span class="van-checkbox__label van-checkbox__label--disabled">
复选框
</span></div>
<div class="van-checkbox">
@ -27,7 +27,7 @@ exports[`renders demo correctly 1`] = `
<!---->
<!---->
</i>
</div> <span class="van-checkbox__label">
</div> <span class="van-checkbox__label van-checkbox__label--disabled">
复选框
</span></div>
</div>

View File

@ -22,7 +22,7 @@ const prefix = (name, mods) => {
}
const ret = {};
Object.keys(mods).forEach(key => {
mods && Object.keys(mods).forEach(key => {
ret[name + MODS + key] = mods[key];
});
return ret;

View File

@ -39,6 +39,14 @@
// Checkbox
@checkbox-size: 20px;
@checkbox-border-color: @gray-light;
@checkbox-transition-duration: .2s;
@checkbox-label-margin: 10px;
@checkbox-label-color: @text-color;
@checkbox-checked-icon-color: @blue;
@checkbox-disabled-icon-color: @gray;
@checkbox-disabled-label-color: @gray;
@checkbox-disabled-background-color: @border-color;
// Info
@info-size: 16px;