mirror of https://github.com/ElemeFE/element
fix bug: default-sort-prop is not defined but trigger sort-change event
parent
48996c6658
commit
59d1f49b1c
|
@ -190,20 +190,22 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
const states = this.store.states;
|
if (this.defaultSortProp) {
|
||||||
states.sortProp = this.defaultSortProp;
|
const states = this.store.states;
|
||||||
states.sortOrder = this.defaultSortOrder;
|
states.sortProp = this.defaultSortProp;
|
||||||
|
states.sortOrder = this.defaultSortOrder;
|
||||||
|
|
||||||
this.$nextTick(_ => {
|
this.$nextTick(_ => {
|
||||||
for (let i = 0, length = this.columns.length; i < length; i++) {
|
for (let i = 0, length = this.columns.length; i < length; i++) {
|
||||||
if (this.columns[i].property === this.defaultSortProp) {
|
if (this.columns[i].property === this.defaultSortProp) {
|
||||||
this.columns[i].order = this.defaultSortOrder;
|
this.columns[i].order = this.defaultSortOrder;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
this.store.commit('changeSortCondition');
|
this.store.commit('changeSortCondition');
|
||||||
});
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
|
Loading…
Reference in New Issue