index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <div class="tabbar">
  3. <div class="tab">
  4. <div class="item active">文章</div>
  5. <div class="item">图片</div>
  6. <div class="item">视频</div>
  7. <div class="item">文件</div>
  8. <div class="item">资料包</div>
  9. </div>
  10. <div class="tab-search">
  11. <input type="text" class="control" placeholder="搜索名称" />
  12. </div>
  13. </div>
  14. </template>
  15. <script>
  16. export default {
  17. name: 'SimpleTabs',
  18. }
  19. </script>
  20. <style scoped lang="scss">
  21. @media screen and (min-width: 768px) {
  22. .tabbar {
  23. display: flex;
  24. justify-content: space-between;
  25. align-items: center;
  26. margin-right: 24px;
  27. .tab-search {
  28. position: relative;
  29. width: 430px;
  30. height: 40px;
  31. border: 1px solid #d8d8d8;
  32. border-radius: 4px;
  33. padding: 0 16px;
  34. padding-left: 46px;
  35. &::after {
  36. position: absolute;
  37. top: 4px;
  38. left: 8px;
  39. content: '';
  40. width: 30px;
  41. height: 30px;
  42. background: url(https://static.caimei365.com/www/authentic/h5/icon-search.png)
  43. no-repeat center;
  44. background-size: 30px;
  45. }
  46. .control {
  47. width: 100%;
  48. height: 36px;
  49. display: block;
  50. border: 0;
  51. outline: none;
  52. line-height: 36px;
  53. background: #fff;
  54. }
  55. }
  56. .tab {
  57. overflow-x: auto;
  58. white-space: nowrap;
  59. height: 64px;
  60. &::-webkit-scrollbar {
  61. display: none;
  62. }
  63. .item {
  64. position: relative;
  65. display: inline-block;
  66. font-size: 20px;
  67. line-height: 64px;
  68. color: #101010;
  69. padding: 0 32px;
  70. cursor: pointer;
  71. &::after {
  72. position: absolute;
  73. content: '';
  74. width: 40px;
  75. height: 2px;
  76. background-color: #fff;
  77. bottom: 0;
  78. left: 50%;
  79. transform: translateX(-50%);
  80. }
  81. &.active {
  82. color: #bc1724;
  83. &::after {
  84. background-color: #bc1724;
  85. }
  86. }
  87. }
  88. }
  89. }
  90. }
  91. @media screen and (max-width: 768px) {
  92. .tabbar {
  93. .tab-search {
  94. display: none;
  95. }
  96. .tab {
  97. overflow-x: auto;
  98. white-space: nowrap;
  99. padding-top: 4vw;
  100. &::-webkit-scrollbar {
  101. display: none;
  102. }
  103. .item {
  104. position: relative;
  105. display: inline-block;
  106. font-size: 4.2vw;
  107. line-height: 8vw;
  108. color: #101010;
  109. padding: 0 6vw;
  110. padding-bottom: 1.2vw;
  111. &::after {
  112. position: absolute;
  113. content: '';
  114. width: 8vw;
  115. height: 0.4vw;
  116. background-color: #fff;
  117. bottom: 0;
  118. left: 50%;
  119. transform: translateX(-50%);
  120. }
  121. &.active {
  122. font-size: 4.6vw;
  123. color: #bc1724;
  124. &::after {
  125. background-color: #bc1724;
  126. }
  127. }
  128. }
  129. }
  130. }
  131. }
  132. </style>