使用element中table组件的排序功能(默认排序和远程排序)

一、table组件的默认排序(此排序只能排当前页面的某列数据)

只需要如下所示:

<el-table-column sortable />

代码:

二、table组件的远程排序(会调用接口排某列的所有数据)

1、在<el-table>组建中要使用@sort-change事件,如下:

2、在<el-table-column />中要使用:sort-orders="['ascending', 'descending']"和sortable="custom"

如下:

3、要在methods里边注册触发排序的方法,如下:

猜你喜欢

转载自blog.csdn.net/weixin_44191318/article/details/125321164