update Table
update Table
This commit is contained in:
parent
52874e27e5
commit
741b987a33
6 changed files with 100 additions and 38 deletions
|
@ -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" @click="handleSortAsc($index)"></i>
|
||||
<i class="ivu-icon ivu-icon-arrow-down-b" @click="handleSortDesc($index)"></i>
|
||||
<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>
|
||||
</span>
|
||||
</template>
|
||||
</div>
|
||||
|
@ -36,6 +36,11 @@
|
|||
cloneData: Array,
|
||||
fixed: Boolean
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
sortType: 'normal'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isSelectAll () {
|
||||
return !this.cloneData.some(data => !data._isChecked);
|
||||
|
@ -65,10 +70,22 @@
|
|||
this.$parent.selectAll(status);
|
||||
},
|
||||
handleSortAsc (index) {
|
||||
this.$parent.handleSort(index, 'asc');
|
||||
if (this.sortType === 'asc') {
|
||||
this.sortType = 'normal';
|
||||
this.$parent.handleSort(index, 'normal');
|
||||
} else {
|
||||
this.sortType = 'asc';
|
||||
this.$parent.handleSort(index, 'asc');
|
||||
}
|
||||
},
|
||||
handleSortDesc (index) {
|
||||
this.$parent.handleSort(index, 'desc');
|
||||
if (this.sortType === 'desc') {
|
||||
this.sortType = 'normal';
|
||||
this.$parent.handleSort(index, 'normal');
|
||||
} else {
|
||||
this.sortType = 'desc';
|
||||
this.$parent.handleSort(index, 'desc');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue