+
@@ -195,6 +213,18 @@ export default {
// },
// },
methods: {
+ // 排序
+ handleSortByColumn(column) {
+ if (column.order === 'ascending') {
+ this.tableData.sort((a, b) =>
+ a[column.prop].localeCompare(b[column.prop])
+ )
+ } else {
+ this.tableData.sort((a, b) =>
+ b[column.prop].localeCompare(a[column.prop])
+ )
+ }
+ },
handleStateChange() {
this.tableData.forEach((item) => {
item.State = this.State