当前位置:   article > 正文

element-ui el-tabs el-tab-pane 的使用_el-tab-pane 设置id

el-tab-pane 设置id

实现效果:1、去掉它的下划线

                   2、标签切换的蓝色线条

                   3、字体,鼠标滑过字体、点击的字体

                   4、如果数据超出,出现左右滑动标签

html

  1. <div class="activity">
  2. <div class="cont">
  3. <el-tabs
  4. v-if="search && search.length > 0"
  5. v-model="first"
  6. @tab-click="handleClick"
  7. >
  8. <el-tab-pane
  9. v-for="(item, index) in search"
  10. :key="index"
  11. :label="item.category_name"
  12. :name="item.id"
  13. :lazy="true"
  14. >
  15. </el-tab-pane>
  16. </el-tabs>
  17. </div>
  18. </div>

css

  1. .activity{
  2. width:98%;
  3. height:58px;
  4. background-color: #ffffff;
  5. margin:0 auto;
  6. margin-top: 34px;
  7. display: flex;
  8. align-items: center;
  9. position: relative;
  10. i{
  11. font-size: 25px;
  12. color:#2d97ff
  13. }
  14. .lefts{
  15. position: absolute;
  16. left:18px
  17. }
  18. .rights{
  19. position: absolute;
  20. right:18px
  21. }
  22. .cont{
  23. width:100%;
  24. height:100%;
  25. margin: 0 auto;
  26. display: flex;
  27. flex-direction:row;
  28. font-size: 20px;
  29. color: #c8c8c8;
  30. span{
  31. display: inline-block;
  32. height: 100%;
  33. display: flex;
  34. align-items: center;
  35. padding-left: 10px;
  36. padding-right: 10px;
  37. margin-right: 18px;
  38. font-size: 20px;
  39. }
  40. }
  41. }
  42. ::v-deep {
  43. .el-tabs {
  44. height: 100%;
  45. overflow: hidden;
  46. display: flex;
  47. overflow: hidden;
  48. flex-direction: column;
  49. .el-tabs__active-bar{
  50. background-color:transparent !important;
  51. }
  52. .el-tabs__header {
  53. padding: 0 5px;
  54. height: 100%;
  55. margin: 0;
  56. .el-tabs__nav-scroll {
  57. height: 58px;
  58. .el-tabs__nav {
  59. width: auto;
  60. display: flex;
  61. justify-content: space-between;
  62. }
  63. .el-tabs__item {
  64. height: 58px;
  65. font-weight: 400;
  66. font-size: 20px;
  67. padding: 0px 22px;
  68. line-height: 58px;
  69. margin-right: 42px;
  70. color:#666666;
  71. margin-left: 18px;
  72. }
  73. .el-tabs__item:hover{
  74. color: #3299ff;
  75. }
  76. .el-tabs__item.is-active {
  77. background-color: #0387fd;
  78. color:white;
  79. border:none
  80. }
  81. }
  82. .el-tabs__nav-prev,
  83. .el-tabs__nav-next {
  84. .el-icon-arrow-left,
  85. .el-icon-arrow-right {
  86. font-size: 20px;
  87. color:#0387fd;
  88. line-height: 58px;
  89. font-weight: 600;
  90. }
  91. }
  92. }
  93. .el-tabs__content {
  94. flex: 1;
  95. padding: 0;
  96. display: flex;
  97. overflow: hidden;
  98. flex-direction: column;
  99. border-top: 11px solid #f0f2f5;
  100. .el-tab-pane {
  101. flex: 1;
  102. padding: 0;
  103. display: flex;
  104. overflow: hidden;
  105. flex-direction: column;
  106. }
  107. }
  108. }
  109. }

小技巧:使用的时候可以通过改变font-size,color 来知道代码对应的是哪一部分

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/530543
推荐阅读
相关标签
  

闽ICP备14008679号