123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- @import './var.less';
- :root {
- --van-tab-text-color: @tab-text-color;
- --van-tab-active-text-color: @tab-active-text-color;
- --van-tab-disabled-text-color: @tab-disabled-text-color;
- --van-tab-font-size: @tab-font-size;
- --van-tab-line-height: @tab-line-height;
- --van-tabs-default-color: @tabs-default-color;
- --van-tabs-line-height: @tabs-line-height;
- --van-tabs-card-height: @tabs-card-height;
- --van-tabs-nav-background-color: @tabs-nav-background-color;
- --van-tabs-bottom-bar-width: @tabs-bottom-bar-width;
- --van-tabs-bottom-bar-height: @tabs-bottom-bar-height;
- --van-tabs-bottom-bar-color: @tabs-bottom-bar-color;
- }
- .van-tab {
- position: relative;
- display: flex;
- flex: 1;
- align-items: center;
- justify-content: center;
- box-sizing: border-box;
- padding: 0 var(--van-padding-base);
- color: var(--van-tab-text-color);
- font-size: var(--van-tab-font-size);
- line-height: var(--van-tab-line-height);
- cursor: pointer;
- &--active {
- color: var(--van-tab-active-text-color);
- font-weight: var(--van-font-weight-bold);
- }
- &--disabled {
- color: var(--van-tab-disabled-text-color);
- cursor: not-allowed;
- }
- &--grow {
- flex: 1 0 auto;
- padding: 0 var(--van-padding-sm);
- }
- &--shrink {
- flex: none;
- padding: 0 var(--van-padding-xs);
- }
- &--card {
- color: var(--van-tabs-default-color);
- border-right: var(--van-border-width-base) solid
- var(--van-tabs-default-color);
- &:last-child {
- border-right: none;
- }
- &.van-tab--active {
- color: var(--van-white);
- background-color: var(--van-tabs-default-color);
- }
- &--disabled {
- color: var(--van-tab-disabled-text-color);
- }
- }
- &__text {
- &--ellipsis {
- display: -webkit-box;
- overflow: hidden;
- -webkit-line-clamp: 1;
- -webkit-box-orient: vertical;
- }
- }
- }
- .van-tabs {
- position: relative;
- &__wrap {
- overflow: hidden;
- &--page-top {
- position: fixed;
- }
- &--content-bottom {
- top: auto;
- bottom: 0;
- }
- }
- &__nav {
- position: relative;
- display: flex;
- background: var(--van-tabs-nav-background-color);
- user-select: none;
- &--complete {
- overflow-x: auto;
- overflow-y: hidden;
- -webkit-overflow-scrolling: touch;
- &::-webkit-scrollbar {
- display: none;
- }
- }
- &--line {
- box-sizing: content-box;
- height: 100%;
- padding-bottom: 15px; /* 15px padding to hide scrollbar in mobile safari */
- }
- &--line&--shrink,
- &--line&--complete {
- padding-right: var(--van-padding-xs);
- padding-left: var(--van-padding-xs);
- }
- &--card {
- box-sizing: border-box;
- height: var(--van-tabs-card-height);
- margin: 0 var(--van-padding-md);
- border: var(--van-border-width-base) solid var(--van-tabs-default-color);
- border-radius: var(--van-border-radius-sm);
- }
- &--card&--shrink {
- display: inline-flex;
- }
- }
- &__line {
- position: absolute;
- bottom: 15px;
- left: 0;
- z-index: 1;
- width: var(--van-tabs-bottom-bar-width);
- height: var(--van-tabs-bottom-bar-height);
- background: var(--van-tabs-bottom-bar-color);
- border-radius: var(--van-tabs-bottom-bar-height);
- }
- &__track {
- position: relative;
- display: flex;
- width: 100%;
- height: 100%;
- will-change: left;
- }
- &__content {
- &--animated {
- overflow: hidden;
- }
- }
- &--line {
- .van-tabs__wrap {
- height: var(--van-tabs-line-height);
- }
- }
- &--card {
- > .van-tabs__wrap {
- height: var(--van-tabs-card-height);
- }
- }
- }
|