tian-yan-yan
Version:
一套不算好用的组件
429 lines (367 loc) • 7.6 kB
text/less
@import "./var.less";
// 修改所有标签的样式
* {
padding: 0;
margin: 0;
word-break: break-all;
}
input:disabled{
background-color: rgba(0,0,0,0);
}
// 修改body
body{
background: @pageColor;
}
button{
font: caption;
}
// 页面box样式
.ty-global-page-box{
padding: 10px;
}
// flex 布局
.ty-global-flex(@a:flex-start, @b:center){
display: flex;
justify-content: @a;
align-items: @b;
}
.ty-global-flex-start{
.ty-global-flex();
}
.ty-global-flex-start-start{
.ty-global-flex(flex-start,flex-start);
}
.ty-global-flex-center{
.ty-global-flex(center);
}
.ty-global-flex-between{
.ty-global-flex(space-between);
}
.ty-global-flex-around{
.ty-global-flex(space-around);
}
.ty-global-flex-evenly{
.ty-global-flex(space-evenly);
}
// 底部线条
.ty-global-bottom-border{
border-bottom: solid 1px @borderColor;
}
// 必填的星号
.ty-global-required{
&:before{
content: '*';
color: #D50000;
font-size: 18px;
}
}
// 没有顶部padding的行样式
.ty-global-row-start{
padding-bottom: 8px;
.ty-global-bottom-border();
}
// 行的内边距
.ty-global-row{
padding: 8px 0;
.ty-global-bottom-border();
}
// 没有底部下划线和padding的行样式
.ty-global-row-end{
padding-top: 8px;
}
// 点击反馈
.ty-global-click-style{
position: relative;
&:before{
position: absolute;
top: 50%;
left: 50%;
width: 100%;
height: 100%;
background-color: #000;
border-color: #000;
border-radius: inherit;
transform: translate(-50%, -50%);
opacity: 0;
content: ' ';
}
&:active:before{
opacity: 0.1;
}
}
//tabs 标签切换
.ty-global-tab-box {
.van-tabs--card {
> .van-tabs__wrap {
height: 40px;
color: #fff;
margin-bottom: 12px;
.van-tabs__nav--card {
height: 100%;
padding: 3px;
box-sizing: border-box;
border: none;
border-radius: 99px;
overflow: auto;
margin: 0;
}
.van-tabs__nav--card .van-tab {
color: @baseColor;
//background: @tabsActiveColor;
border-right: none;
flex-grow: 1;
}
.van-tabs__nav--card .van-tab.van-tab--active {
color: @tabsActiveColor;
background: @tabsActiveBgColor;
border-radius: 99px;
overflow: hidden;
}
}
.van-tab {
flex-grow: 0;
flex-shrink: 0;
flex-basis: auto;
padding: 7px 22px;
}
.van-tab__text--ellipsis{
overflow: visible;
}
}
}
// 折叠框样式
.ty-global-collapse-box{
.van-cell{
padding: 5px 0;
&:after{
border-bottom: none;
}
}
.van-hairline--top-bottom::after{
border-color: @borderColor;
}
.van-collapse-item__content{
padding: 5px;
color: #262626;
border-top: solid 1px @borderColor;
}
&+.ty-global-collapse-box{
border-top: solid 1px @borderColor;
}
}
// 模块样式-用于模块之间的分隔-提供圆角,背景白色,padding:10
.ty-global-model-box {
padding: 10px;
background: #fff;
border-radius: 8px;
& + .ty-global-model-box {
margin-top: 10px;
}
}
// 进入动画
@keyframes tyGlobalAdd {
0%{
transform: translateY(50px);
opacity: 0;
}
100%{
transform: translateY(0);
opacity: 1;
}
}
.ty-global-animation-out{
opacity: 0;
animation: tyGlobalAdd ease-in-out 1s forwards;
}
// 旋转动画
@keyframes tyGlobalRotate {
0%{
transform: rotateX(90deg);
}
100%{
transform: rotateX(0);
}
}
.ty-global-animation-rotate{
animation: tyGlobalRotate ease-in-out 0.3s forwards;
}
// 从左边进入动画
@keyframes tyGlobalLeft {
0%{
transform: translateX(-100%);
}
100%{
transform: translateX(0);
}
}
.ty-global-animation-left{
animation: tyGlobalLeft ease-in-out 0.3s forwards;
}
// 呼吸动画
@keyframes tyGlobalBreathe {
0%{
transform: scale(1);
}
50%{
transform: scale(0.9);
}
100%{
transform: scale(1);
}
}
.ty-global-animation-breath{
animation: tyGlobalBreathe 1s forwards;
}
/* ---------- 描述信息样式 S ---------- */
.ty-global-title {
font-size: 14px;
color: @titleColor;
& + .ty-global-value,
& + .ty-global-value-bold,
& + .ty-global-value-bold-red {
margin-left: 5px;
}
}
.ty-global-value {
font-size: 14px;
color: @fontColor;
}
.ty-global-value-bold{
.ty-global-value();
font-weight: bold;
}
.ty-global-value-bold-red{
.ty-global-value-bold();
color: #D50000;
}
/* ---------- 描述信息样式 E ---------- */
// 输入框标题显示冒号
.ty-global-show-colon:after{
content: ':';
margin-left: 3px;
font-weight: bold;
}
// 标题前的短横线
.ty-global-title-left-line{
.ty-global-flex-start();
&:before{
content: ' ';
display: block;
width: 5px;
background: @baseColor;
height: 16px;
border-radius: 4px;
margin-right: 5px;
}
}
// 徽标
.ty-global-tip-box{
position: relative;
.ty-global-tip{
position: absolute;
top: 0;
right: 0;
padding: 0 3px;
height: 15px;
border-radius: 999px;
color: #fff;
font-weight: 500;
text-align: center;
font-size: 12px;
line-height: 1.2;
transform: translate(90%,-40%);
border: 1px solid #fff;
display: inline-block;
box-sizing: border-box;
min-width: 16px;
font-family: -apple-system-font, Helvetica Neue, Arial, sans-serif;
background-color: #ee0a24;
}
}
// 溢出隐藏
.ty-global-text-overflow{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
// 分隔线
// 水平分割线
.ty-global-sh {
height: 1px;
background: #f0f0f0;
}
// 垂直分隔线
.ty-global-sv {
width: 1px;
background: white;
}
// 属性列表样式(定位于块节点)
.ty-global-props {
&.label-align-right > div > div:first-child {
text-align: right;
}
&.label-vertical-align > div > div:first-child {
flex-basis: 5.6em;
}
& > div {
display: flex;
align-items: center;
& > div:first-child {
margin-right: 5px;
color: gray;
&:after {
content: ':';
}
}
& > div:nth-child(2) {
flex: 1 0 0;
}
& > div:not(:first-child) {
color: #232323;
}
}
}
// 数字板样式(定位于块节点)
.ty-global-board-nums {
display: flex;
justify-content: space-between;
margin: 10px -10px 0;
padding: 15px;
background: #e44b51;
color: white;
text-align: center;
font-size: 0.9em;
&.bottom-radius {
margin-bottom: -10px;
border-radius: 0 0 8px 8px;
}
& > div {
& > div:first-child {
font-size: 1.2em;
}
& > div:last-child {
margin-top: 5px;
}
}
}
// 数据看板项样式
.ty-global-data-look-item{
text-align: center;
>.ty-global-value,>.ty-global-value-bold,>.ty-global-value-bold-red{
font-size: 16px;
}
}
// 外边框
.ty-global-border-2px{
border: solid 2px @baseColor;
}
// 上圆角
.ty-global-model-top-radius{
.ty-global-model-box();
border-radius: 10px 10px 0 0;
}
// 下圆角
.ty-global-model-bottom-radius{
.ty-global-model-box();
border-radius: 0 0 10px 10px;
}