element-中table文字居中对齐

element-中table文字居中对齐

想要让table组件中的文字居中对齐,需要找到所有的th,td,给它们加上text-align:center;但是在自己的组件中想要获取到th、td需要用到样式穿透,less的样式穿透为:/deep/; scss的样式穿透为:::v-deep

设置文字居中对齐示例(scss):

::v-deep .el-table th,
::v-deep .el-table td {
  text-align: center !important;
}

猜你喜欢

转载自blog.csdn.net/weixin_47346395/article/details/107322201
今日推荐