npm install ele-easy-table -S
import 'ele-easy-table'
<ele-easy-table :form="form" :table="table" :formData.sync="formData" @getList="handleSearch"></ele-easy-table>
See demo source code for details
Depends on element-ui, your project must install element-ui
Element-ui version used by source code
"element-ui": "^2.4.5"
property | illustrate | type | default value |
---|---|---|---|
form | Table query condition area | Object | {} |
table | Table display area | Object | {} |
formData.sync | form query fields | Object | {} |
pagination | Whether to display the paging area | [Boolean,Object] | true |
other attributes | el-table native properties | Refer to el-table native properties | - |
property | illustrate | type | default value | Remark |
---|---|---|---|---|
class | Table query condition area style setting | Object | - | - |
style | Table query condition area inline style setting | Object | - | - |
foldNum | Table collapses when there are more than many query conditions | Number | - | Without this parameter, all will be displayed |
list | Table query condition list | Array | - | See demo source code for details |
property | illustrate | type | default value | Remark |
---|---|---|---|---|
list | Table data list | Array | - | - |
columns | Table header list | Array | - | See demo source code for details |
isLoading | Whether to display table loading animation | Boolean | - | |
showIndex | Whether to display the serial number column | Boolean | true | |
indexFixed | Whether to fix the serial number column | Boolean | false | |
indexLabel | Customize the header text of the serial number list | String | serial number | |
selection | Form multiple selection configuration | Object | {} |
property | illustrate | type | default value | Remark |
---|---|---|---|---|
config | Form multiple selection properties | Object | - | - |
el-pagination native attribute
Executed when the page number is switched or the number displayed on each page changes, the data is obtained, and then assigned to table.list to update the list.
el-table native events, for example: @selection-change="handleSelectionChange" See demo source code for details
event | illustrate | parameter |
---|---|---|
handleExpand | Callback event after conditional folding | isExpand |
The table has a new inline style overflow: visible; to implement sticky layout of the table header, just add the following style
Note: If it is a scoped style, you need to use the >>> operator (see the document CSS scope for details)
/* 全局样式 */
. el-table__header-wrapper {
position : sticky;
top : 0 ;
z-index : 999 ;
}
/* scoped 局部样式 */
. ele-easy-table-demo > > > . el-table__header-wrapper {
position : sticky;
top : 0 ;
z-index : 999 ;
}
See demo source code for details
Note: It cannot be used with column fixation at the same time. To use it at the same time, you can use the element native table attribute to set the table height. There is no need to set this style.