mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 16:06:28 +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) {
|
if (targetKeys.length > 0) {
|
||||||
targetKeys.forEach((targetKey) => {
|
targetKeys.forEach((targetKey) => {
|
||||||
rightDataSource.push(leftDataSource.find((data, index) => {
|
rightDataSource.push(leftDataSource.filter((data, index) => {
|
||||||
if (data.key === targetKey) {
|
if (data.key === targetKey) {
|
||||||
leftDataSource.splice(index, 1);
|
leftDataSource.splice(index, 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}));
|
})[0]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +133,12 @@ class Transfer extends Component {
|
|||||||
handleSelect(direction, selectedItem, checked) {
|
handleSelect(direction, selectedItem, checked) {
|
||||||
const { leftCheckedKeys, rightCheckedKeys } = this.state;
|
const { leftCheckedKeys, rightCheckedKeys } = this.state;
|
||||||
const holder = direction === 'left' ? leftCheckedKeys : rightCheckedKeys;
|
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) {
|
if (index > -1) {
|
||||||
holder.splice(index, 1);
|
holder.splice(index, 1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user