element-ui的table控件表头与内容列不对齐

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

element-ui的table控件表头与内容列不对齐

wwf1225   2022-09-28 我要评论

element-ui的table表格控件表头与内容列不对齐

解决方法

将以下样式代码添加到index.html、或app.vue中(必须是入口文件,起全局作用!)

body .el-table th.gutter{
display: table-cell!important;
}

例如(app.vue):

<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>
<script>
  export default{
     name: 'APP'
  }
</script>
<style>
  /* 解决element-ui的table表格控件表头与内容列不对齐问题 */
  .el-table th.gutter{
    display: table-cell!important;
  }
</style>
<style lang="scss">
  @import './styles/index.scss'; // 全局自定义的css样式
</style>

el-table表头和表格列宽不一样问题

直接上图

解决办法

1.网上找的办法

将以下样式代码添加到index.html、或app.vue中(必须是入口文件,起全局作用!)

body .el-table th.gutter{
display: table-cell!important;
}

2.自己新建css文件common.css,在文件中将上面样式写入

/* 解决element-ui的table表格控件表头与内容列不对齐问题 */
body .el-table th.gutter{
  display: table-cell!important;
}

3.在main.js文件中引入common.css文件

import '@/style/common.css'

以上为个人经验,希望能给大家一个参考,也希望大家多多支持。

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们