Ant Design 表头居中,内容居中
- Ant Design 表头居中的做法:
const columns = [
{
title: '单位名称',
dataIndex: 'jwqbm',
width: '146',
align:'center'
}
}
直接在定义列的时候,定义:align:‘center’;
- Ant Design 内容居中的做法:
在定义列的时候,定义一个className:‘class-center-sum’,
const columns = [
{
title: '单位名称',
dataIndex: 'jwqbm',
width: '146',
align:'center'
},
{
title: '授权社区民警',
children:[
{
title: '总数',
dataIndex: 'sqsqmj_total',
className:'class-center-sum',
align:'center'
}
]
}
}
然后我们可以在css样式中定义
<style lang="less">
th.class-center-sum,
td.class-center-sum {
text-align: center;
}
</style>
然后就可以看结果了。