1. 程式人生 > 其它 >vue表格排序

vue表格排序

技術標籤:筆記

<el-table :data="userList" border stripe :row-style="{height:0+'px'}" :cell-style="userListcellStyle" highlight-current-row style="margin-top:30px" @sort-change="sortChange">
		<el-table-column label="訂單金額" prop="orderAmount"
width="200" sortable="custom">
</el-table-column> </el-table>
  //排序
        sortChange(column, prop, order) {
            console.log(column.prop); //prop標籤 => nickname
            console.log(column.order); //descending降序、ascending升序
            // if (column.order == 'descending') {
// this.queryInfo.orderContent = 'desc'; // } // if (column.order == 'ascending') { // this.queryInfo.orderContent = 'asc'; // } // if (column.order == null) { // this.queryInfo.orderContent = ''; // } // this.queryInfo.orderBy = 'order_amount';
this.queryInfo.orderContent = column.order; this.queryInfo.orderBy = column.prop; this.getOrderList(); },