File tree 1 file changed +17
-2
lines changed
1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 24
24
border
25
25
fit
26
26
highlight-current-row
27
- style =" width : 100% ;" >
28
- <el-table-column :label =" $t('table.id')" align =" center" width =" 65" >
27
+ style =" width : 100% ;"
28
+ @sort-change =" sortChange" >
29
+ <el-table-column :label =" $t('table.id')" prop =" id" sortable =" custom" align =" center" width =" 65" >
29
30
<template slot-scope="scope">
30
31
<span >{{ scope.row.id }}</span >
31
32
</template >
@@ -233,6 +234,20 @@ export default {
233
234
})
234
235
row .status = status
235
236
},
237
+ sortChange (data ) {
238
+ const { prop , order } = data
239
+ if (prop === ' id' ) {
240
+ this .sortByID (order)
241
+ }
242
+ },
243
+ sortByID (order ) {
244
+ if (order === ' ascending' ) {
245
+ this .listQuery .sort = ' +id'
246
+ } else {
247
+ this .listQuery .sort = ' -id'
248
+ }
249
+ this .handleFilter ()
250
+ },
236
251
resetTemp () {
237
252
this .temp = {
238
253
id: undefined ,
You can’t perform that action at this time.
0 commit comments