when using the Element UI to design a table, the style of the table might look something like this, if not specially decorated, but sometimes we need to add some style.
p>
check the official documentation and we find the following properties. The style is controlled by the classification of row, cell, header-row and header-cell.
parameter | description | type | optional value | 1 default value |
---|---|---|---|---|
5 row-class-name | 7 row className callback method, can also use a string to set a fixed className for all rows. | Function({row, rowIndex})/String | / | / |
row-style | 1 row style callback method, also can use a fixed Object to set the same style for all rows. | Function({row, rowIndex})/Object | / | / |
cell-class-name | 1 cell className callback method. Td> | Function({row, column, rowIndex, columnIndex})/String | / | / |
cell-style | 1 cell style callback method, can also use a fixed Object to set the same style for all cells. Td> | Function({row, column, rowIndex, columnIndex})/Object | / | / |
header-row-class-name | 1 header rows can also be set to a fixed className using a string. | Function({row, rowIndex})/String | / | / |
header-row-style | 1 style callback method. | Function({row, rowIndex})/Object | / | / |
header-cell-class-name | 1 Td> | Function({row, column, rowIndex, columnIndex})/String | / | / |
header-cell-style | 1 header cell style callback method, can also use a fixed Object to set the same style for all header cells. | Function({row, column, rowIndex, columnIndex})/Object | / | / |
p>
p>
p>
add a black background to the table below, with white text darkening
adds the cell-style and header-cell-style properties to el-table and passes in the function, which is the same because the table header and table data are styled the same. p>
<el-table :cell-style="cellStyle" :header-cell-style="cellStyle">
Below
is the function body
cellStyle() {
return {
background: "#000000",
color: "#ffffff",
};
},
p>
p>
p>
div>
Read More:
- The togglerowexpansion method of the table of element UI expands the specified row
- Insufficient table space ORA-00604 unable to extend table SYS.AUD by 8192
- 1093 – You can’t specify target table ‘table’ for update in FROM clause
- Vue + element, SCSS plus / deep / style does not work
- The total row of the Element table entry page is not displayed
- Errors in IntelliJ ieeasql statements and table names in @ table
- Error 1146 (42s02): table ‘database name. Table name’ doesn’t exist ‘
- Research on invalid modification of elementui component style
- In the SQL query statement, add the column that does not exist in the table and set the fixed value of the column
- An error occurred when opensips started the service“ ERROR:core :db_ check_ table_ Version: invalid version 7 for Table dialog found “
- Hexo + next add bilibilibili icon through custom style
- Lua — using remove to delete table data
- Property ‘style’ does not exist on type ‘element‘
- How can Oracle query tables of other users without adding a table user name
- DB: the solution of table already exist when migrating
- 【Exception】mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table…
- Unknown custom element: <component> – did you register the component correctly
- [Vue warn]: Failed to resolve component vue3 import element error
- mysql ERROR 1050 (42S01): Table already exists
- [react+antd] Table Error: Unhandled Rejection (TypeError): data.slice is not a function