Element UI table setting align="center" does not take effect

insert image description here
In this way, the data is set to be centered but it does not take effect, and setting header-align="left" does not take effect

Solution:
Add the following content to the el-table tag
: cell-style="{ textAlign:'center'}" //Center the content
: header-cell-style="{ textAlign:'center'}"//Table header in the center

<template>
  <el-table
    border
    :cell-style="{ textAlign:'center'}"
	:header-cell-style="{ textAlign:'center'}"
    >
    <el-table-column prop="date" label="日期" > </el-table-column>
    <el-table-column  prop="name" label="姓名" > </el-table-column>
    <el-table-column prop="address" label="地址" > </el-table-column>
  </el-table>
</template> 

Guess you like

Origin blog.csdn.net/weixin_44244924/article/details/130371261