UNPKG

w-ui

Version:

A Vue.js 2.0 UI Toolkit for mobile

171 lines (155 loc) 3.4 kB
@line-color: #D9D9D9; .top-line(@color, @zindex: 0) { content: ''; position: absolute; z-index: @zindex; top: 0; left: 0; width: 100%; border-top: 1px solid @color; -webkit-transform: scaleY(.5); transform: scaleY(.5); -webkit-transform-origin: 0 0; transform-origin: 0 0; } .bottom-line(@color, @zindex: 0) { content: ''; position: absolute; z-index: @zindex; bottom: 0; left: 0; width: 100%; border-bottom: 1px solid @color; -webkit-transform: scaleY(.5); transform: scaleY(.5); -webkit-transform-origin: 0 0; transform-origin: 0 0; } // 遮罩层 // ----------------------------------------------------------------------------- .mask(@bgcolor: rgba(0, 0, 0, .4), @z-index: @base-zindex * 1500) { background-color: @bgcolor; position: fixed; z-index: @z-index; bottom: 0; right: 0; left: 0; top: 0; display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -webkit-justify-content: center; -ms-flex-pack: center; justify-content: center; -webkit-box-align: center; -webkit-align-items: center; -ms-flex-align: center; align-items: center; } @picker-item-height: 38px; .wui { &-picker-mask { .mask(rgba(0, 0, 0, .4), 1500 + 2); } &-picker { position: fixed; bottom: 0; left: 0; width: 100%; z-index: 1500 + 2; background-color: #FFF; transform: translate(0, 100%); transition: transform .25s; touch-action: none; &-active { transform: translate(0, 0); } } &-picker-input { width: 100%; height: 0.6rem; line-height: 0.6rem; } &-picker-head { display: flex; justify-content: space-between; position: relative; background-color: #FBFBFB; &:after { .bottom-line(@line-color); } > a { height: 43px; padding: 0 30px; font-size: 15px; display: flex; align-items: center; color: #555; } > a:last-child { color: dodgerblue; } } &-picker-content { position: relative; width: 100%; height: @picker-item-height * 7; overflow: hidden; display: flex; } &-picker-item { font-size: 16px; height: 100%; position: relative; flex: 1; } &-picker-item-content { > span { width: 100%; display: block; height: @picker-item-height; line-height: @picker-item-height; text-align: center; } } &-picker-item-box { height: 100%; } &-picker-shade, &-picker-indicator { pointer-events: none; position: absolute; left: 0; top: 0; height: 100%; width: 100%; } &-picker-shade { z-index: 3; transform: translateZ(0px); background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.6)), linear-gradient(to top, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.6)); background-position: top, bottom; background-size: 100% @picker-item-height * 3; background-repeat: no-repeat; } &-picker-indicator { z-index: 4; display: flex; justify-content: center; flex-direction: column; > span { display: block; width: 100%; height: @picker-item-height; position: relative; &:after { .top-line(@line-color); } &:before { .bottom-line(@line-color); } } } }