Commit 59d1f49b authored by njleonzhang's avatar njleonzhang

fix bug: default-sort-prop is not defined but trigger sort-change event

parent 48996c66
......@@ -190,20 +190,22 @@ export default {
},
mounted() {
const states = this.store.states;
states.sortProp = this.defaultSortProp;
states.sortOrder = this.defaultSortOrder;
this.$nextTick(_ => {
for (let i = 0, length = this.columns.length; i < length; i++) {
if (this.columns[i].property === this.defaultSortProp) {
this.columns[i].order = this.defaultSortOrder;
break;
if (this.defaultSortProp) {
const states = this.store.states;
states.sortProp = this.defaultSortProp;
states.sortOrder = this.defaultSortOrder;
this.$nextTick(_ => {
for (let i = 0, length = this.columns.length; i < length; i++) {
if (this.columns[i].property === this.defaultSortProp) {
this.columns[i].order = this.defaultSortOrder;
break;
}
}
}
this.store.commit('changeSortCondition');
});
this.store.commit('changeSortCondition');
});
}
},
beforeDestroy() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment