Skip to content

Commit 75c603b

Browse files
committedOct 25, 2017
fix(MdTable): change sort methods
1 parent 64a332b commit 75c603b

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed
 

‎package.json

-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
"scripts": {
2525
"dev": "babel-node build/local",
2626
"build": "babel-node build/lib",
27-
"build-analyze": "babel-node build/lib --analyze",
2827
"docs": "babel-node build/docs",
29-
"docs-analyze": "babel-node build/docs --analyze",
3028
"lint": "eslint --ext .js,.vue docs src build test",
3129
"test": "jest",
3230
"coverage": "yarn test --coverage",
@@ -43,7 +41,6 @@
4341
"dependencies": {
4442
"date-fns": "^1.29.0",
4543
"deepmerge": "^2.0.0",
46-
"lodash": "^4.17.4",
4744
"popper.js": "^1.12.5",
4845
"raf": "^3.4.0",
4946
"vue": "^2.5.2"

‎src/components/MdTable/MdTable.vue

+9-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,15 @@
6767
mdSortFn: {
6868
type: Function,
6969
default (value) {
70-
return orderBy(value, [this.MdTable.sort], [this.MdTable.sortOrder])
70+
return value.sort((a, b) => {
71+
const sortBy = this.MdTable.sort
72+
73+
if (this.MdTable.sortOrder === 'desc') {
74+
return a[sortBy].localeCompare(b[sortBy])
75+
}
76+
77+
return b[sortBy].localeCompare(a[sortBy])
78+
})
7179
}
7280
}
7381
},

0 commit comments

Comments
 (0)