<el-table v-loading="fourthloading" :data="tableData4" style="width: 100%" height="390" @sort-change="sortChange" ref="fourthtable"> //@sort-change <el-table-column prop="title" label="项目名" /> <el-table-column prop="money" label="签约金额" sortable="true" width="86" /> <el-table-column prop="grossMargin" label="毛利" sortable="true" /> <el-table-column prop="grossMarginRate" label="毛利率" sortable="true" /> <el-table-column prop="advance_amount" label="垫资金额" sortable="true" width="86" /> </el-table>
sortChange(column) { this.tableData = [] if (column) { var sort console.log(column, 'columncolumncolumn') if (column.order === 'ascending') { // 这里双重判断:该字段为升序时向后端传递升序参数,反之降序 sort = `${column.prop},asc` } else if (column.order === 'descending') { sort = `${column.prop},desc` } // this.fourthloading = true this.sort_param = sort // noticeboard_project_list_amounts({ limit: 500, 'sort_param': sort, title: this.input4 }).then((res) => { // this.tableData4 = res.data.list // this.fourthloading = false // }) } },
标签:sort,column,res,param,升序,table,排序 From: https://www.cnblogs.com/yu412/p/17629120.html