element中实现表头或者表居中的方式

如果仅仅想实现表头居中而表里面的内容不变

            
            <el-table-column
                v-for="(e, i) in columns1"
                :key="i"
                header-align="center"    // 仅表头居中
                :prop="e.code"
                :label="e.name"
                sortable
                width="150"
            >
                <template slot-scope="scope">
                <span>{{ scope.row[e.code]}}</span>
                </template>
            </el-table-column>

如果想实现表头和表内的数据都居中

            
             <el-table-column
                v-for="(e, i) in columns1"
                :key="i"
                :prop="e.code"
                :label="e.name"
                align="center"   //表头和数据都居中
                sortable
                width="150"
              >
                <template slot-scope="scope">
                <span>{{ scope.row[e.code]}}</span>
                </template>
              </el-table-column>
原文地址:https://www.cnblogs.com/axingya/p/14328608.html