File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -210,7 +210,8 @@ export default {
210
210
211
211
mounted ( ) {
212
212
const { prop, order } = this . defaultSort ;
213
- this . store . commit ( 'sort' , { prop, order } ) ;
213
+ const init = true ;
214
+ this . store . commit ( 'sort' , { prop, order, init } ) ;
214
215
} ,
215
216
216
217
beforeDestroy ( ) {
Original file line number Diff line number Diff line change @@ -259,7 +259,7 @@ TableStore.prototype.mutations = {
259
259
changeSortCondition ( states , options ) {
260
260
states . data = sortData ( ( states . filteredData || states . _data || [ ] ) , states ) ;
261
261
262
- if ( ! options || ! options . silent ) {
262
+ if ( ! options || ! ( options . silent || options . init ) ) {
263
263
this . table . $emit ( 'sort-change' , {
264
264
column : this . states . sortingColumn ,
265
265
prop : this . states . sortProp ,
@@ -271,7 +271,7 @@ TableStore.prototype.mutations = {
271
271
} ,
272
272
273
273
sort ( states , options ) {
274
- const { prop, order } = options ;
274
+ const { prop, order, init } = options ;
275
275
if ( prop ) {
276
276
states . sortProp = prop ;
277
277
states . sortOrder = order || 'ascending' ;
@@ -286,7 +286,9 @@ TableStore.prototype.mutations = {
286
286
}
287
287
288
288
if ( states . sortingColumn ) {
289
- this . commit ( 'changeSortCondition' ) ;
289
+ this . commit ( 'changeSortCondition' , {
290
+ init : init
291
+ } ) ;
290
292
}
291
293
} ) ;
292
294
}
You can’t perform that action at this time.
0 commit comments