当前位置:   article > 正文

Vue3 第三十二篇:常用组件:Tab栏_vue3 tab

vue3 tab

JSX:

  1. import style from './towards.module.css'
  2. const Towards=()=>{
  3. return(
  4. <>
  5. <div id='navRight2' className={style.navRight2}>
  6. <div className={style.towardsLeft} title="向左滑">
  7. <el-icon><ArrowLeft /></el-icon>
  8. </div>
  9. <div className={style.towardsMiddle}>
  10. <div className={style.tabTitleBox}>
  11. <Tabs></Tabs>
  12. </div>
  13. </div>
  14. <div className={style.towardsRight}title="向右滑">
  15. <el-icon><ArrowRight /></el-icon>
  16. </div>
  17. </div>
  18. </>
  19. )
  20. }
  21. const Tabs=()=>{
  22. let tabList = [
  23. {
  24. id: 1,
  25. name: '首页'
  26. },
  27. {
  28. id: 2,
  29. name: 'Socket'
  30. }
  31. ]
  32. let is_drag = false // 当前是否正在拖拽
  33. let dragTab = null // 当前正在拖拽的tab
  34. return(
  35. <>
  36. {
  37. tabList.map(x=>{
  38. return(
  39. <>
  40. <div key={x.id} id={'tab-' + x.id } className={style.tabTitle} draggable={true} onDragstart={[is_drag = true, dragTab = x]} onDragend={is_drag = false}>
  41. <div className={style.tabTitle2}>
  42. <span>{x.name}</span>
  43. <el-icon><Close /></el-icon>
  44. </div>
  45. </div>
  46. </>
  47. )
  48. })
  49. }
  50. </>
  51. )
  52. }
  53. export default Towards

CSS

  1. /* 第二行建筑物 */
  2. .navRight2,.nav-right-bre{height: 35px; position: relative; z-index: 110; box-shadow: 0 2px 2px #CCC;}
  3. .navRight2>div{height: 100%; position: absolute;}
  4. .nav-right-bre{line-height: 35px; padding-left: 1em; background-color: #FFF; cursor: pointer; display: none;}
  5. .nav-right-bre .el-breadcrumb__item{line-height: 35px; font-size: 13px; }
  6. /* .nav-right-bre .el-breadcrumb__item:hover{cursor: pointer; text-decoration: underline;} */
  7. .navRight2 .towardsLeft,.navRight2 .towardsRight{width: 24px; text-align: center; background-color: #FFF; cursor: pointer; line-height: 35px;}
  8. .navRight2 .towardsLeft{border-right: 1px #eee solid;}
  9. .navRight2 .towardsRight{border-left: 1px #eee solid; right: 0px;}
  10. .navRight2 .towardsLeft:hover i,.navRight2 .towardsRight:hover i{font-size: 1.1em;font-weight: bold;}
  11. .navRight2 .towardsMiddle{width: 10000px; overflow: auto;/* calc(100% - 50px) */ left: 25px;background-color: #EEE;}
  12. .navRight2 .tabTitleBox{display: inline-block; position: absolute; left: 0px; transition: all 0.2s;}
  13. .navRight2 .tabTitle{font-size: 13px; cursor: pointer; float: left; transition: all 0.15s;white-space: nowrap;overflow: hidden;text-decoration: none; color: #333;}
  14. .navRight2 .tabTitle2{padding: 0px 10px; height: 35px; margin-right: 1px; background-color: #FFF; line-height: 35px; }
  15. .navRight2 .tabTitle2{transition: padding 0.1s, margin 0.1s;}
  16. .navRight2 .tabTitle2 *{transition: all 0.0s;}
  17. /* .tabTitle .el-icon-caret-right{color: #EEE; font-size: 1.7em; position: relative; top: 4px;} */
  18. .navRight2 .tabTitle .el-icon-close{display: inline-block; border-radius: 50%; padding: 1px; color: #ccc; margin-left: -4px;}
  19. .navRight2 .tabTitle .el-icon-close:hover{background-color: red; color: #FFF;}
  20. .navRight2 .tabTitle span{display: inline-block; margin-left: 10px; margin-right: 10px;}
  21. .navRight2 .tabTitle:hover span,.navRight2 .tab-native span{font-weight: bold;}

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

闽ICP备14008679号