diff --git a/examples/routers/table.vue b/examples/routers/table.vue
index 9a9f96c..9ea6e50 100644
--- a/examples/routers/table.vue
+++ b/examples/routers/table.vue
@@ -21,15 +21,16 @@
title: '姓名',
key: 'name',
width: 100,
- fixed: 'left',
sortable: true,
- renderHeader: (h, params) => {
- return h('Tag', params.index)
- }
+// fixed: 'left',
+// renderHeader: (h, params) => {
+// return h('Tag', params.index)
+// }
},
{
title: '年龄',
key: 'age',
+ sortable: true,
width: 100
},
{
diff --git a/src/components/table/table-head.vue b/src/components/table/table-head.vue
index 63d048b..45c5adc 100644
--- a/src/components/table/table-head.vue
+++ b/src/components/table/table-head.vue
@@ -10,7 +10,7 @@
- {{ column.title || '#' }}
+ {{ column.title || '#' }}
@@ -134,6 +134,19 @@
}
this.$parent.handleSort(index, type);
},
+ handleSortByHead (index) {
+ const column = this.columns[index];
+ if (column.sortable) {
+ const type = column._sortType;
+ if (type === 'normal') {
+ this.handleSort(index, 'asc');
+ } else if (type === 'asc') {
+ this.handleSort(index, 'desc');
+ } else {
+ this.handleSort(index, 'normal');
+ }
+ }
+ },
handleFilter (index) {
this.$parent.handleFilter(index);
},
--
libgit2 0.21.4