diff --git a/src/components/table/table-head.vue b/src/components/table/table-head.vue index c7646c44..1cf0484c 100644 --- a/src/components/table/table-head.vue +++ b/src/components/table/table-head.vue @@ -11,8 +11,8 @@ @@ -36,11 +36,6 @@ objData: Object, fixed: Boolean }, - data () { - return { - sortType: 'normal' - } - }, computed: { isSelectAll () { let isSelectAll = true; @@ -74,23 +69,11 @@ const status = !this.isSelectAll; this.$parent.selectAll(status); }, - handleSortAsc (index) { - if (this.sortType === 'asc') { - this.sortType = 'normal'; - this.$parent.handleSort(index, 'normal'); - } else { - this.sortType = 'asc'; - this.$parent.handleSort(index, 'asc'); - } - }, - handleSortDesc (index) { - if (this.sortType === 'desc') { - this.sortType = 'normal'; - this.$parent.handleSort(index, 'normal'); - } else { - this.sortType = 'desc'; - this.$parent.handleSort(index, 'desc'); + handleSort (index, type) { + if (this.columns[index]._sortType === type) { + type = 'normal'; } + this.$parent.handleSort(index, type); } } } diff --git a/src/components/table/table.vue b/src/components/table/table.vue index 81748a72..243d660f 100644 --- a/src/components/table/table.vue +++ b/src/components/table/table.vue @@ -1,5 +1,4 @@