<!-- Issue Template For Chinese Users --> <!-- 请按照下列格式报告问题,务必提供复现步骤,否则恕难解决,感谢您的支持。--> #### 本地环境 <!-- 务必提供 --> - antd 版本: - 操作系统及其版本: - 浏览器及其版本: #### 你做了什么?对表格设置ClassName <!-- 引入 antd 了 Button --> #### 你期待的结果是:开辟新属性,能够设置表表头左对齐、居中对齐、右对齐三种 <!-- 像官网一样正常显示 --> #### 实际上的结果:仅表格内数据居中对齐,但表头仍是左对齐 <!-- 缺少样式 --> #### 可重现的在线演示 <!-- 请修改并 Fork http://codepen.io/anon/pen/wGOWGW?editors=001 -->
Activity
afc163 commentedon Jul 22, 2016
column.classNamehttp://ant.design/components/table/#components-table-demo-bordered
qiannianv commentedon Jul 22, 2016
这个试过了,但改变的只有表格内的数据居中了,但表头仍然是居左的,我是想让表头也跟着居中
编辑器没法截图吗,很想截图跟你表达一下
afc163 commentedon Jul 22, 2016
http://codepen.io/anon/pen/Jbzmpv?editors=0110
qiannianv commentedon Jul 22, 2016
谢谢~~ 实现了~~
afc163 commentedon Jul 22, 2016
👍
zhonggithub commentedon Sep 25, 2016
哥们 是怎么做到 列头 居中的??
feilongOnMoudu commentedon Dec 14, 2016
@qiannianv 你怎么实现让表格组件的表头居中的 我试了 并没有什么用啊?
能附上你写的代码吗?
zhonggithub commentedon Dec 21, 2016
要重写 columns 的className 这样可以实现
.table-column-center-important {
text-align: center !important;
font-size: 14px;
}
henryzp commentedon Apr 24, 2017
@afc163 ,为什么不直接提供align参数呢??
一般来说,可能其他的css很少有操作,align的场景会比较多一些。。
afc163 commentedon Apr 24, 2017
@henryzp 可以考虑来个 PR ~
henryzp commentedon Apr 25, 2017
@afc163 pr,那个test用例(即tests/snapshots)下的文件模板要改一下,我现在的没有修改,导致结果通不过
feat: add headerAlign and bodyAlign(ant-design/ant-design#2465)
Nirodhiko commentedon Sep 7, 2017
表头居然不能居中,怎么越用这个组件越觉得坑,虽然这个东西是开源的,我并没有资格去抱怨,但觉得这样的坑实在是太不应该了.
coryisbest0728 commentedon Sep 7, 2017
@zhongshun89 可以用column的className来设置表头的样式。默认是居左的。
zhonggithub commentedon Sep 7, 2017
@zhongshun89 你用熟悉了就会了。他的官方文档其实是有介绍过的。我以前做c++ 的,没做过web .我刚刚开始用的时候也是到处碰壁,觉得在使用ant 的时候,更应该先了解的他的设计原则和设计哲学。ant 对开发者的友好度还是很不错的。
Nirodhiko commentedon Sep 7, 2017
@zhonggithub 我以前也做过c++ ^_^
Nirodhiko commentedon Sep 8, 2017
解决办法
在el-table-column里面设置className="column_center"
colume_center 的样式为
.column_center {
text-align: center !important;
}
在vue单文件组件中的<style>模块属性里不能加 scoped 属性,否则依然居中不了.
afc163 commentedon Sep 8, 2017
@zhongshun89 别回复错仓库了。
afc163 commentedon Oct 22, 2017
trace react-component/table#137
afc163 commentedon Nov 12, 2017
@yesmeck 这个在 3.0 里做掉吧。
Add column[align]
yesmeck commentedon Nov 13, 2017
react-component/table@f4ff62a