bin-ui
Version:
基于 vue2.6 / vue-cli3 的 UI 组件库
105 lines (99 loc) • 1.76 kB
text/stylus
.bin-switch {
display: inline-block;
width: 44px;
height: 22px;
line-height: 20px;
border-radius: 22px;
vertical-align: middle;
border: 1px solid #ccc;
background-color: #ccc;
position: relative;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
transition: all $animation-duration-base ease-in-out;
&:after {
content: "";
width: 18px;
height: 18px;
border-radius: 18px;
background-color: #fff;
position: absolute;
left: 1px;
top: 1px;
cursor: pointer;
transition: left $animation-duration-base ease-in-out, width $animation-duration-base ease-in-out;
}
&:focus {
box-shadow: 0 0 0 2px $color-input-shadow;
outline: 0;
}
&:active:after {
width: 26px;
}
}
.bin-switch-inner {
color: #fff;
font-size: 12px;
position: absolute;
left: 23px;
i {
text-align: center;
position: relative;
font-size: 18px;
top: -1px;
}
}
.bin-switch-checked {
border-color: $color-primary;
background-color: $color-primary;
&:after {
left: 23px;
}
&:active:after {
left: 15px;
}
.bin-switch-inner {
left: 7px;
}
}
.bin-switch-large {
width: 56px;
&.bin-switch-checked:after {
left: 35px;
}
&:active {
&.bin-switch-checked:after {
left: 23px;
}
&:after {
width: 30px;
}
}
}
.bin-switch-small {
width: 28px;
height: 16px;
line-height: 14px;
&.bin-switch-checked:after {
left: 13px;
}
&:after {
width: 12px;
height: 12px;
}
&:active {
&.bin-switch-checked:after {
left: 11px;
}
&:after {
width: 14px;
}
}
}
.bin-switch-disabled {
cursor: not-allowed;
opacity: .4;
}