Преглед на файлове

fix bug: default sort doesnot dismiss

njleonzhang преди 8 години
родител
ревизия
22cea4e6c4
променени са 1 файла, в които са добавени 7 реда и са изтрити 3 реда
  1. 7 3
      packages/table/src/table-header.js

+ 7 - 3
packages/table/src/table-header.js

@@ -197,13 +197,17 @@ export default {
 
       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;
+          let column = this.columns[i];
+          if (column.property === this.defaultSortProp) {
+            column.order = this.defaultSortOrder;
+            states.sortingColumn = column;
             break;
           }
         }
 
-        this.store.commit('changeSortCondition');
+        if (states.sortingColumn) {
+          this.store.commit('changeSortCondition');
+        }
       });
     }
   },