sort-change当表格的排序条件发生变化的时候会触发该事件:

调试发现方法已执行,但是最终排序未生效到表格。因为表格排序只执行一次,需要禁掉默认排序。
<el-table
class="table"
ref="table"
:data="list"
:default-sort="{prop: 'SlideNo', order:'ascending'}"
@sort-change="sortChange"
>
</el-table>
 
自定义排序 :
sortChange(column, prop, order) {
    //需要先清除默认排序 !!!
    if (this.$refs.table) this.$refs.table.clearSort()
    // sort...
}

 

~~~ 测试通过,已按自定义排序 ~~~

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-03
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
  • 2021-12-09
  • 2021-04-19
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案