Skip to content
Snippets Groups Projects
Unverified Commit ec58373a authored by 花裤衩's avatar 花裤衩 Committed by GitHub
Browse files

add an example of sort data by table (#1236)

parent bf2629ff
No related branches found
No related tags found
No related merge requests found
......@@ -24,8 +24,9 @@
border
fit
highlight-current-row
style="width: 100%;">
<el-table-column :label="$t('table.id')" align="center" width="65">
style="width: 100%;"
@sort-change="sortChange">
<el-table-column :label="$t('table.id')" prop="id" sortable="custom" align="center" width="65">
<template slot-scope="scope">
<span>{{ scope.row.id }}</span>
</template>
......@@ -233,6 +234,20 @@ export default {
})
row.status = status
},
sortChange(data) {
const { prop, order } = data
if (prop === 'id') {
this.sortByID(order)
}
},
sortByID(order) {
if (order === 'ascending') {
this.listQuery.sort = '+id'
} else {
this.listQuery.sort = '-id'
}
this.handleFilter()
},
resetTemp() {
this.temp = {
id: undefined,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment