Table: support sort-by. can't sort if sort-by is null

pull/7900/head
wangfengming 2017-10-30 12:25:07 +08:00 committed by 杨奕
parent f642294949
commit 877718099e
1 changed files with 2 additions and 3 deletions

View File

@ -40,10 +40,9 @@ export const orderBy = function(array, sortKey, reverse, sortMethod, sortBy) {
}); });
} }
if (sortKey !== '$key') { if (sortKey !== '$key') {
if (isObject(value) && '$value' in value) return [value.$value]; if (isObject(value) && '$value' in value) value = value.$value;
} else {
return [isObject(value) ? getValueByPath(value, sortKey) : value];
} }
return [isObject(value) ? getValueByPath(value, sortKey) : value];
}; };
const compare = function(a, b) { const compare = function(a, b) {
if (sortMethod) { if (sortMethod) {