mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 05:05:48 +08:00
fix(transfer): fix compatibility es2015 function, close #944
This commit is contained in:
parent
f540b1c201
commit
31ae114a19
@ -28,12 +28,12 @@ class Transfer extends Component {
|
||||
|
||||
if (targetKeys.length > 0) {
|
||||
targetKeys.forEach((targetKey) => {
|
||||
rightDataSource.push(leftDataSource.find((data, index) => {
|
||||
rightDataSource.push(leftDataSource.filter((data, index) => {
|
||||
if (data.key === targetKey) {
|
||||
leftDataSource.splice(index, 1);
|
||||
return true;
|
||||
}
|
||||
}));
|
||||
})[0]);
|
||||
});
|
||||
}
|
||||
|
||||
@ -133,7 +133,12 @@ class Transfer extends Component {
|
||||
handleSelect(direction, selectedItem, checked) {
|
||||
const { leftCheckedKeys, rightCheckedKeys } = this.state;
|
||||
const holder = direction === 'left' ? leftCheckedKeys : rightCheckedKeys;
|
||||
const index = holder.findIndex((key) => key === selectedItem.key);
|
||||
let index;
|
||||
holder.forEach((key, i) => {
|
||||
if (key === selectedItem.key) {
|
||||
index = i;
|
||||
}
|
||||
});
|
||||
if (index > -1) {
|
||||
holder.splice(index, 1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user