| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- /* components/form-ruler/form-ruler.wxss */
- // 定义一个混合,用于生成三角形
- @mixin triangle($size, $color, $direction) {
- height: 0;
- width: 0;
- border-color: transparent;
- border-style: solid;
- border-width: $size * 0.5;
- @if $direction=='up' {
- border-bottom-color: $color;
- }
- @else if $direction=='right' {
- border-left-color: $color;
- }
- @else if $direction=='down' {
- border-top-color: $color;
- }
- @else if $direction=='left' {
- border-right-color: $color;
- }
- @else {
- @error "Unknown direction #{$direction}.";
- }
- }
- .show-data {
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: flex-end;
- margin: 12px 0;
- font-size: 12px;
- .value {
- margin: 0 4px;
- font-size: 18px;
- }
- }
- .form-ruler {
- --height: 56px;
- --width: 100%;
- --active-color: #34A76B;
- --tick-width: 5px;
- position: relative;
- width: calc(var(--width) + 2px);
- height: calc(var(--height) + 2px);
- border: 1px solid #D3D4D5;
- border-radius: var(--height);
- box-sizing: border-box;
- overflow: hidden;
- &::before,
- &::after {
- content: '';
- position: absolute;
- left: 50%;
- transform: translateX(-50%);
- }
- &::before {
- top: 0;
- @include triangle(14px, var(--active-color), 'down');
- }
- &::after {
- bottom: 0;
- @include triangle(14px, var(--active-color), 'up');
- }
- &__inner {
- display: flex;
- flex-direction: row;
- align-items: center;
- height: 100%;
- }
- &__axis {
- position: relative;
- height: 32px;
- transform: translateY(calc(var(--height) * 0.25));
- font-size: 12px;
- width: 5px;
- box-sizing: border-box;
- text {
- position: absolute;
- left: 2px;
- bottom: -10px;
- }
- .tick {
- height: calc(var(--height) * 0.2);
- border-left: 1px solid #D3D4D5;
- }
- .median {
- height: calc(var(--height) * 0.32);
- border-left: 1px solid #D3D4D5;
- }
- .integer {
- height: calc(var(--height) * 0.5);
- border-left: 1px solid #D3D4D5;
- }
- }
- }
|