update Table

update Table
This commit is contained in:
梁灏 2016-11-28 16:53:19 +08:00
parent 731d69a29a
commit 35ad37642d
3 changed files with 77 additions and 54 deletions

View file

@ -11,8 +11,8 @@
<template v-else>
{{{ renderHeader(column, $index) }}}
<span :class="[prefixCls + '-sort']" v-if="column.sortable">
<i class="ivu-icon ivu-icon-arrow-up-b" :class="{on: sortType === 'asc'}" @click="handleSortAsc($index)"></i>
<i class="ivu-icon ivu-icon-arrow-down-b" :class="{on: sortType === 'desc'}" @click="handleSortDesc($index)"></i>
<i class="ivu-icon ivu-icon-arrow-up-b" :class="{on: column._sortType === 'asc'}" @click="handleSort($index, 'asc')"></i>
<i class="ivu-icon ivu-icon-arrow-down-b" :class="{on: column._sortType === 'desc'}" @click="handleSort($index, 'desc')"></i>
</span>
</template>
</div>
@ -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);
}
}
}