el-table 设置表头居中 ,表格内容某一列居中或左对齐或者右对齐,或者统一设置对齐样式

el-table 设置表头居中
:header-cell-style=“headClass” ==》methods中定义表头居中样式
:cell-style=“rowClass” ==》统一设置column的样式web

<el-table
            ref="multipleTable"
            :data="commentData"
            tooltip-effect="dark"
            style="width: 100%;margin-top:15px;"//width:100%,每一个column的width或min-width超出剩余宽度会出现横向滚动条,用来展现表格行内容
            :stripe="true"   //添加斑马纹
            :cell-style="rowClass"//统一设置column的样式
            :header-cell-style="headClass"//methods中定义
            @selection-change="handleSelectionChange"//添加多选项
          >

methods:bash

// 表头样式设置
    headClass() {
      return "text-align: center;background:#f7f7f7;";
    },
    // 表格样式设置
    rowClass() {
      return "text-align: center;";
    },

单独设置某一列内容居中或者居左居右对齐给column加属性align:center/left/right将er-table的表格统同样式:cell-style删除便可svg

<el-table-column align="center" label="ISBN" width="150" show-overflow-tooltip>
              <template slot-scope="scope">{{ scope.row.bookNumber }}</template>
            </el-table-column>
            <el-table-column align="left" prop="bookName" label="图书名称" min-width="230" show-overflow-tooltip></el-table-column>
            <el-table-column align="center" prop="author" label="做者" min-width="160" show-overflow-tooltip></el-table-column>
            <el-table-column align="left" prop="press" label="出版社" min-width="160" show-overflow-tooltip></el-table-column>
            <el-table-column align="center" label="图书大类" min-width="100" show-overflow-tooltip>
              <template slot-scope="scope">{{ scope.row.bookCategory }}</template>
            </el-table-column>