fix[complex-table]: form header sort icon is out of sync (#2382)

This commit is contained in:
why 2019-07-16 17:12:26 +08:00 committed by 花裤衩
parent 9ff40abd74
commit 7be0bd5751
1 changed files with 9 additions and 1 deletions

View File

@ -35,7 +35,7 @@
style="width: 100%;"
@sort-change="sortChange"
>
<el-table-column :label="$t('table.id')" prop="id" sortable="custom" align="center" width="80">
<el-table-column :label="$t('table.id')" prop="id" sortable="custom" align="center" width="80" :class-name="getSortClass('id')">
<template slot-scope="scope">
<span>{{ scope.row.id }}</span>
</template>
@ -375,6 +375,14 @@ export default {
return v[j]
}
}))
},
getSortClass: function(key) {
const sort = this.listQuery.sort
return sort === `+${key}`
? 'ascending'
: sort === `-${key}`
? 'descending'
: ''
}
}
}