美文网首页
在elementUI中sort-orders排序,默认为三种,怎

在elementUI中sort-orders排序,默认为三种,怎

作者: 双耳云 | 来源:发表于2019-07-05 17:35 被阅读0次

1.在 table表单中添加sort-change事件, :sort-orders="['ascending', 'descending']"

<el-table :data.sync="tableData" border height="520" size="small" class="table"
                  ref="multipleTable"
                  style="width:100%"
                  :row-key="getRowKeys"
                  @sort-change="getSortChange"
                  :sort-orders="['ascending', 'descending']"
                  @selection-change="handleSelectionChange">
         <el-table-column type="selection" :reserve-selection="true"  width="55"></el-table-column>
          <el-table-column prop="code" label="编号" v-if="show_code" sortable :sort-orders="['ascending', 'descending']"></el-table-column>
          <el-table-column prop="title" label="广告名称" v-if="show_title"></el-table-column>
</el-table>

2.js

//排序
getSortChange(column){
    if (column.order === 'descending') {
      this.orderByColumn = column.prop;
      this.isAsc = 'desc'
    } else {
      this.orderByColumn = column.prop;
      this.isAsc = 'asc'
    }
    this.list()
},

相关文章

网友评论

      本文标题:在elementUI中sort-orders排序,默认为三种,怎

      本文链接:https://www.haomeiwen.com/subject/szpzqctx.html