300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > element更改表格表头 行 指定单元格样式

element更改表格表头 行 指定单元格样式

时间:2020-09-16 06:34:32

相关推荐

element更改表格表头 行 指定单元格样式

element更改表格表头、行、指定单元格样式

更改表格的样式

使用header-cell-style属性,可为函数或对象

函数写法

<!-- html --><el-table :header-cell-style="rowClass"></el-table>

//在method里面写上方法rowClass({row, rowIndex}) {console.log(rowIndex) //表头行标号为0return 'background:red'}

2.对象写法

<!-- html --><el-table :header-cell-style="{background:'red'}"></el-table>

更改表格中某个单元格的样式

1.函数写法

<!-- html --><el-table :header-cell-style="cellStyle"></el-table>

//在method里面写上方法cellStyle({row, column, rowIndex, columnIndex}){if(rowIndex === 1 && columnIndex === 2){//指定坐标return 'background:pink'}else{return ''}}

2.对象写法

<!-- html --><el-table :cell-style="{background:'pink'}"></el-table>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。