UNPKG

jdvue

Version:

A Vue.js 2.0 Mobile UI components at JinDanLiCai

196 lines (177 loc) 4.48 kB
@checkbox-prefix-cls: ~"@{css-prefix}checkbox"; @checkbox-group-prefix-cls: ~"@{checkbox-prefix-cls}-group"; @checkbox-wrapper-prefix-cls: ~"@{checkbox-prefix-cls}-wrapper"; @checkbox-inner-prefix-cls: ~"@{checkbox-prefix-cls}-inner"; @cursor-disabled: ~"not-allowed"; @border: ~"#e6e8eb"; // 普通状态 .@{checkbox-prefix-cls} { display: inline-block; vertical-align: middle; white-space: nowrap; cursor: pointer; //outline: none; position: absolute; &-disabled { cursor: @cursor-disabled; } &-inner { display: inline-block; width: 16px; height: 16px; position: relative; top: 1px; left: 0; border: 1px solid @border; border-radius: 50%; background-color: #fff; transition: border-color .2s ease-in-out, background-color .2s ease-in-out, box-shadow .2s ease-in-out; &:after { content: ''; display: table; width: 4px; height: 7px; position: absolute; top: 2px; left: 5px; border: 2px solid #fff; border-top: 0; border-left: 0; transform: rotate(45deg) scale(0); transition: all .2s ease-in-out; } } &-input { width: 100%; height: 100%; position: absolute; top: 0; bottom: 0; left: 0; right: 0; z-index: 1; cursor: pointer; opacity: 0; &[disabled] { cursor: @cursor-disabled; } } } // 选中状态 .@{checkbox-prefix-cls}-checked { .@{checkbox-inner-prefix-cls} { border-color: @green; background-color: @green; &:after { content: ''; display: table; position: absolute; border: 2px solid #fff; border-top: 0; border-left: 0; transform: rotate(45deg) scale(1); transition: all .2s ease-in-out; } } } // 禁用 .@{checkbox-prefix-cls}-disabled { &.@{checkbox-prefix-cls}-checked { .@{checkbox-inner-prefix-cls} { background-color: #f3f3f3; border-color: @border; &:after { animation-name: none; border-color: #ccc; } } } .@{checkbox-inner-prefix-cls} { border-color: @border; background-color: #f3f3f3; &:after { animation-name: none; border-color: #f3f3f3; } } .@{checkbox-inner-prefix-cls}-input { cursor: default; } &+span { color: #ccc; cursor: @cursor-disabled; } } .@{checkbox-wrapper-prefix-cls} { cursor: pointer; font-size: 16px; display: inline-block; //margin-right: 8px; //outline: none; &-disabled { cursor: @cursor-disabled; } } .@{checkbox-wrapper-prefix-cls}+span, .@{checkbox-prefix-cls}+span { //margin-left: 4px; //margin-right: 4px; } .@{checkbox-prefix-cls}-group { font-size: 14px; &-item { display: inline-block; } } .@{checkbox-prefix-cls}-text-wrapper{ padding-left: 26px; display: inline-block; position: relative; top: -1px; line-height: 1.5; } .@{checkbox-prefix-cls}, .@{checkbox-group-prefix-cls} { &-large { &.@{checkbox-wrapper-prefix-cls}, & .@{checkbox-wrapper-prefix-cls} { font-size: 18px; } & .@{checkbox-inner-prefix-cls} { width: 18px; height: 18px; &:after { width: 5px; height: 9px; top: 2px; left: 6px; } } .@{checkbox-inner-prefix-cls}{ top: 3px; } .@{checkbox-prefix-cls}-text-wrapper{ padding-left: 28px; } } &-small { &.@{checkbox-wrapper-prefix-cls}, & .@{checkbox-wrapper-prefix-cls} { font-size: 12px; } & .@{checkbox-inner-prefix-cls} { width: 12px; height: 12px; &:after { width: 2px; height: 5px; top: 2px; left: 4px; } } .@{checkbox-inner-prefix-cls}{ top: 1px; } .@{checkbox-prefix-cls}-text-wrapper{ padding-left: 22px; } } }