vant-weapp/packages/tabs/index.less
neverland 1a7889590f
perf: remove CSS variables polyfill (#4487)
* perf: remove CSS variables polyfill

* style: fix missing calc value

* perf: reduce some useless css vars
2021-09-23 17:31:28 +08:00

155 lines
3.2 KiB
Plaintext

@import '../common/style/var.less';
.van-tabs {
position: relative;
-webkit-tap-highlight-color: transparent;
&__wrap {
display: flex;
overflow: hidden;
&--scrollable {
.van-tab {
flex: 0 0 22%;
&--complete {
flex: 1 0 auto !important;
padding: 0 @padding-sm;
}
}
.van-tabs__nav {
&--complete {
padding-right: 8px;
padding-left: 8px;
}
}
}
}
&__scroll {
background-color: var(
--tabs-nav-background-color,
@tabs-nav-background-color
);
&--line {
box-sizing: content-box;
// 15px padding to hide scrollbar in mobile safari
height: calc(100% + 15px);
}
&--card {
margin: 0 var(--padding-md, @padding-md);
}
&::-webkit-scrollbar {
display: none;
}
}
&__nav {
position: relative;
display: flex;
user-select: none;
&--card {
box-sizing: border-box;
height: var(--tabs-card-height, @tabs-card-height);
border: @border-width-base solid
var(--tabs-default-color, @tabs-default-color);
border-radius: @border-radius-sm;
.van-tab {
color: var(--tabs-default-color, @tabs-default-color);
line-height: calc(
var(--tabs-card-height, @tabs-card-height) - 2 * @border-width-base
);
border-right: @border-width-base solid
var(--tabs-default-color, @tabs-default-color);
&:last-child {
border-right: none;
}
&.van-tab--active {
color: @white;
background-color: var(--tabs-default-color, @tabs-default-color);
}
&--disabled {
color: var(--tab-disabled-text-color, @tab-disabled-text-color);
}
}
}
}
&__line {
position: absolute;
bottom: 0;
left: 0;
z-index: 1;
height: var(--tabs-bottom-bar-height, @tabs-bottom-bar-height);
border-radius: var(--tabs-bottom-bar-height, @tabs-bottom-bar-height);
background-color: var(--tabs-bottom-bar-color, @tabs-bottom-bar-color);
}
&__track {
position: relative;
width: 100%;
height: 100%;
&--animated {
display: flex;
transition-property: left;
}
}
&__content {
overflow: hidden;
}
&--line {
.van-tabs__wrap {
height: var(--tabs-line-height, @tabs-line-height);
}
}
&--card {
.van-tabs__wrap {
height: var(--tabs-card-height, @tabs-card-height);
}
}
}
.van-tab {
position: relative;
flex: 1;
box-sizing: border-box;
min-width: 0; /* hack for flex ellipsis */
padding: 0 5px;
text-align: center;
cursor: pointer;
color: var(--tab-text-color, @tab-text-color);
font-size: var(--tab-font-size, @tab-font-size);
line-height: var(--tabs-line-height, @tabs-line-height);
&--active {
font-weight: var(--font-weight-bold, @font-weight-bold);
color: var(--tab-active-text-color, @tab-active-text-color);
}
&--disabled {
color: var(--tab-disabled-text-color, @tab-disabled-text-color);
}
&__title {
&__info {
position: relative !important;
top: -1px !important;
display: inline-block;
transform: translateX(0) !important;
}
}
}