Skip to content

Commit 338083d

Browse files
authored
Update mixin-sorting.js
1 parent 2069083 commit 338083d

File tree

1 file changed

+16
-22
lines changed

1 file changed

+16
-22
lines changed

src/components/table/helpers/mixin-sorting.js

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import stableSort from '../../../utils/stable-sort'
22
import startCase from '../../../utils/startcase'
33
import looseEqual from '../../../utils/loose-equal'
44
import { arrayIncludes, concat } from '../../../utils/array'
5-
import { isBoolean, isFunction, isNumber, isUndefined, isUndefinedOrNull } from '../../../utils/inspect'
5+
import { isBoolean, isFunction, isNumber, isUndefined } from '../../../utils/inspect'
66
import defaultSortCompare from './default-sort-compare'
77

88
export default {
@@ -186,30 +186,24 @@ export default {
186186
this.$off('head-clicked', this.handleSort)
187187
}
188188
},
189-
sortBy: {
190-
immediate: true,
191-
handler(newVal, oldVal) {
192-
if (looseEqual(newVal, this.localSortBy)) {
193-
/* istanbul ignore next */
194-
return
195-
}
196-
// TODO in this PR:
197-
// Update sortInfo object
198-
this.localSortBy = newVal ? concat(newVal) : []
189+
sortBy(newVal, oldVal) {
190+
if (looseEqual(newVal, this.localSortBy)) {
191+
/* istanbul ignore next */
192+
return
199193
}
194+
// TODO in this PR:
195+
// Update sortInfo object
196+
this.localSortBy = newVal ? concat(newVal) : []
200197
},
201-
sortDesc: {
202-
immediate: true,
203-
handler(newVal, oldVal) {
204-
if (looseEqual(newVal, this.localSortDesc)) {
205-
/* istanbul ignore next */
206-
return
207-
}
208-
// TODO in this PR:
209-
// Update sortInfo object
210-
newVal = isUndefined(newVal) ? [] : concat(newVal)
211-
this.localSortDesc = newVal.map(d => (isBoolean(d) ? d : null))
198+
sortDesc(newVal, oldVal) {
199+
if (looseEqual(newVal, this.localSortDesc)) {
200+
/* istanbul ignore next */
201+
return
212202
}
203+
// TODO in this PR:
204+
// Update sortInfo object
205+
newVal = isUndefined(newVal) ? [] : concat(newVal)
206+
this.localSortDesc = newVal.map(d => (isBoolean(d) ? d : null))
213207
},
214208
// Update .sync props
215209
// TODO in this PR:

0 commit comments

Comments
 (0)