sortable 远程排序

elementUI table api 对应列是否可以排序,如果设置为 ‘custom’,则代表用户希望远程排序,需要监听 Table 的 sort-change 事件

elementUI table sortable 远程排序
elementUI table sortable 远程排序

sort-change方法自带三个参数

sort-change 当表格的排序条件发生变化的时候会触发该事件 { column, prop, order }

column:当前列
prop:当前列需要排序的数据
order:排序的规则(升序、降序和默认[默认就是没排序])

sortChange(column) {
  if(column.order == "ascending") {
     this.form.sort = '1'
   } else if(column.order == "descending") {
     this.form.sort = '0'
   }
   this.getList()
 },

相关文章: