@import './func.scss'; $boxBorderColor: #999898; $boxCheckedColor: #1890ff; $boxDisabledColor: #d9d9d9; @mixin check-box() { .check-box-inner { position: relative; display: inline-block; margin-top: 2px; padding: 0; width: 14px; height: 14px; background-color: #fff; border: 1px solid $boxBorderColor; @include user-select(none); @include border-radius(2px); @include transition(all .2s); cursor: pointer; >svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; fill: #fff; transform: scale(0); opacity: 0; @include transition(all .08s cubic-bezier(.78, .14, .15, .86)); } } >input[type="checkbox"] { display: none; &:checked+.check-box-inner { border-color: $boxCheckedColor; background-color: $boxCheckedColor; >svg { transform: scale(1); opacity: 1; } } &:disabled { &+.check-box-inner { border-color: $boxDisabledColor; cursor: default; } &:checked+.check-box-inner { border-color: $boxDisabledColor; background-color: $boxDisabledColor; } &~span { color: $boxDisabledColor; cursor: default; } } } /* &.disabled { .check-box-inner { border-color: $boxDisabledColor; cursor: default; } >input:checked+.check-box-inner { border-color: $boxDisabledColor; background-color: $boxDisabledColor; } >span { color: $boxDisabledColor; cursor: default; } } */ }