Cascader: fix filter

pull/7226/head
Leopoldthecoder 2017-09-26 13:51:00 +08:00 committed by 杨奕
parent f457cd7f57
commit 2fae006ba1
1 changed files with 7 additions and 3 deletions

View File

@ -10,9 +10,13 @@
arr.forEach(item => { arr.forEach(item => {
const itemCopy = {}; const itemCopy = {};
configurableProps.forEach(prop => { configurableProps.forEach(prop => {
const propName = props[prop] || prop; let name = props[prop];
const value = item[propName]; let value = item[name];
if (value !== undefined) itemCopy[propName] = value; if (value === undefined) {
name = prop;
value = item[name];
}
if (value !== undefined) itemCopy[name] = value;
}); });
if (Array.isArray(item[childrenProp])) { if (Array.isArray(item[childrenProp])) {
itemCopy[childrenProp] = copyArray(item[childrenProp], props); itemCopy[childrenProp] = copyArray(item[childrenProp], props);