Use the sorting function of the table component in element (default sorting and remote sorting)

1. The default sorting of table components (this sorting can only sort a certain column of data on the current page)

Just need to look like this:

<el-table-column sortable />

code:

2. Remote sorting of table components (the interface will be called to sort all the data in a column)

1. The @sort-change event should be used in the formation of <el-table>, as follows:

2. Use in <el-table-column />: sort-orders="['ascending', 'descending']" and sortable="custom"

as follows:

3. To register the trigger sorting method in methods, as follows:

Guess you like

Origin blog.csdn.net/weixin_44191318/article/details/125321164