index.less 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. @import '../style/var';
  2. .van-tab {
  3. flex: 1;
  4. cursor: pointer;
  5. min-width: 0; // hack for flex ellipsis
  6. padding: 0 5px;
  7. font-size: 14px;
  8. position: relative;
  9. color: @gray-darker;
  10. line-height: @tabs-line-height;
  11. text-align: center;
  12. box-sizing: border-box;
  13. span {
  14. display: block;
  15. }
  16. &--active {
  17. font-weight: 500;
  18. color: @text-color;
  19. }
  20. &--disabled {
  21. color: @gray;
  22. }
  23. }
  24. .van-tabs {
  25. position: relative;
  26. &__wrap {
  27. top: 0;
  28. left: 0;
  29. right: 0;
  30. z-index: 99;
  31. overflow: hidden;
  32. position: absolute;
  33. &--page-top {
  34. position: fixed;
  35. }
  36. &--content-bottom {
  37. top: auto;
  38. bottom: 0;
  39. }
  40. &--scrollable {
  41. .van-tab {
  42. flex: 0 0 22%;
  43. &--complete {
  44. flex: 1 0 auto;
  45. }
  46. }
  47. .van-tabs__nav {
  48. overflow: hidden;
  49. overflow-x: auto;
  50. -webkit-overflow-scrolling: touch;
  51. &::-webkit-scrollbar {
  52. display: none;
  53. }
  54. }
  55. }
  56. }
  57. &__nav {
  58. display: flex;
  59. user-select: none;
  60. position: relative;
  61. background-color: @white;
  62. &--line {
  63. height: 100%;
  64. padding-bottom: 15px; /* 15px padding to hide scrollbar in mobile safari */
  65. box-sizing: content-box;
  66. }
  67. &--card {
  68. margin: 0 15px;
  69. border-radius: 2px;
  70. box-sizing: border-box;
  71. border: 1px solid @red;
  72. height: @tabs-card-height;
  73. .van-tab {
  74. color: @red;
  75. border-right: 1px solid @red;
  76. line-height: @tabs-card-height - 2px;
  77. &:last-child {
  78. border-right: none;
  79. }
  80. &.van-tab--active {
  81. color: @white;
  82. background-color: @red;
  83. }
  84. &--disabled {
  85. color: @gray;
  86. }
  87. }
  88. }
  89. }
  90. &__line {
  91. z-index: 1;
  92. left: 0;
  93. bottom: 15px;
  94. height: 3px;
  95. position: absolute;
  96. border-radius: 3px;
  97. background-color: @red;
  98. }
  99. &__content {
  100. &--animated {
  101. overflow: hidden;
  102. }
  103. }
  104. &__track {
  105. position: relative;
  106. display: flex;
  107. width: 100%;
  108. height: 100%;
  109. will-change: left;
  110. }
  111. &--line {
  112. padding-top: @tabs-line-height;
  113. .van-tabs__wrap {
  114. height: @tabs-line-height;
  115. }
  116. }
  117. &--card {
  118. padding-top: @tabs-card-height;
  119. > .van-tabs__wrap {
  120. height: @tabs-card-height;
  121. }
  122. }
  123. .van-tab__pane {
  124. width: 100%;
  125. flex-shrink: 0;
  126. box-sizing: border-box;
  127. }
  128. }