当前位置:   article > 正文

Element-ui中el-tabs的下划线样式微调_el-tabs页面缩放时下划线

el-tabs页面缩放时下划线

1.页面加载周期结束之后调用方法

        

  1. mounted: function () {
  2. this.handleClick()
  3. },

2.写这个方法

  1. handleClick () {
  2. this.resetActivePosition(this.$refs.tabs.$el)
  3. },
  4. resetActivePosition ($el) { // tabs的样式修改
  5. this.$nextTick(() => {
  6. const activeEl = $el.querySelector('.el-tabs__item.is-active');
  7. const lineEl = $el.querySelector('.el-tabs__active-bar');
  8. const style = getComputedStyle(activeEl);
  9. const pl = style.paddingLeft.match(/\d+/)[0] * 1;
  10. const pr = style.paddingRight.match(/\d+/)[0] * 1;
  11. const w = style.width.match(/\d+/)[0] * 1;
  12. lineEl.style.transform = 'translateX(' + (activeEl.offsetLeft + pl) + 'px)';
  13. lineEl.style.width = (w - pl - pr) + 'px';
  14. })
  15. },

3.el-tabs上绑定ref就可以了

        

  1. <el-tabs ref="tabs" v-model="activeName" @tab-click="handleClick" class="tabs">
  2. <!-- <el-tab-pane :label="'体检项目' + info.xm + '项'" name="first"> -->
  3. <el-tab-pane label="体检项目" name="first">
  4. <div class="tab1">
  5. <!-- <el-table style="width: 100%;height: 80%;overflow: auto;" ref="multipleTable" :data="tjxmList" tooltip-effect="dark"> -->
  6. <el-table ref="multipleTable" height="calc(100vh - 240px)" border style="width: 100%" :data="info.tjxmList" tooltip-effect="dark">
  7. <el-table-column type="selection">
  8. </el-table-column>
  9. <el-table-column label="项目" sortable prop="mc">
  10. </el-table-column>
  11. <el-table-column label="原价" sortable prop="xmdj">
  12. </el-table-column>
  13. <el-table-column label="折扣" sortable>
  14. </el-table-column>
  15. <el-table-column label="实价" sortable>
  16. </el-table-column>
  17. <el-table-column label="付费方式" sortable>
  18. </el-table-column>
  19. <el-table-column label="科室" sortable>
  20. </el-table-column>
  21. <el-table-column label="状态" sortable prop="zt">
  22. </el-table-column>
  23. <el-table-column label="操作">
  24. <template slot-scope="scope">
  25. <el-button v-if="!scope.row.children" type="text" size="small" style="color: #f56c6c" @click="delfw(scope.row)">删除</el-button>
  26. </template>
  27. </el-table-column>
  28. </el-table>
  29. <div class="operater">
  30. <span class="operater_left">登记人:{{ info.xm }}/<span class="tj_color">{{ info.cjsj }}</span></span>
  31. <span class="operater_left">共计{{ info.tjxmList ? info.tjxmList.length : 0 }}项 | 总价:<span class="tj_color">{{ totalPrice }}元</span>
  32. <!-- 已收:<span class="tj_color">300.00</span> 待收:<span class="tj_color">200.00</span>--> </span>
  33. <span class="operater_btns">
  34. <!-- <el-button type="btns">删除</el-button> -->
  35. <el-button type="btns" @click="addTc">添加</el-button>
  36. <el-button type="btns">套餐</el-button>
  37. </span>
  38. </div>
  39. </div>
  40. </el-tab-pane>
  41. <el-tab-pane label="收费信息" name="second">收费信息</el-tab-pane>
  42. <el-tab-pane label="历史体检(3次)" name="third">历史体检</el-tab-pane>
  43. <el-tab-pane label="科室检查(5/10)" name="fourth">科室检查</el-tab-pane>
  44. <el-tab-pane label="操作记录(50)" name="five">操作记录</el-tab-pane>
  45. </el-tabs>

4.结果:下划线就可以向左边偏移一点了,看起来更好看

 

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

闽ICP备14008679号