epmet pc工作端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
381 B

/**
* 深度克隆
*/
export function getItemByIdInCascader(arr, vals, idName, childName) {
let item = arr.find((v) => v[idName] == vals[0]);
if (vals.length > 1) {
return [
item,
...getItemByIdInCascader(
item[childName],
vals.slice(1),
idName,
childName
),
];
} else {
return [item];
}
}