ant-design/components/upload/getFileItem.js

11 lines
287 B
JavaScript
Raw Normal View History

2015-08-21 16:19:28 +08:00
export default function getFileItem(file, fileList) {
let matchWay = (!file.uid) ? 'byName' : 'byUid';
let target = fileList.filter((item) => {
if (matchWay === 'byName') {
return item.name === file.name;
2015-08-21 16:19:28 +08:00
}
return item.uid === file.uid;
2015-08-21 16:19:28 +08:00
})[0];
return target;
2015-08-24 21:16:00 +08:00
}