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'
以上为个人经验,希望能给大家一个参考,也希望大家多多支持。
查看更多关于解决element-ui的table表格控件表头与内容列不对齐问题的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did123542