isRepeat = (arr, str) => {
let hash = {};
for (let i in arr) {
if (hash[arr[i]]) {
message.error("第" + (Number(i) + 1) + `行${str},请确认后重新导入`);
this.setState({ isFalseData: true })
return true;
}
hash[arr[i]] = true;
}
return false;
}
//引用
handleJugement = (rows) => {
if (this.isRepeat(bondCodeRepeatArr, '有重复项')) {
return false;
}
}
坑的是react table中去写编辑行的时候,当我离开这个组件,一直提示我Can’t perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
方法一:https://segmentfault.com/a/1190000017186299?utm_source=tag-newest
方法二 、三、四 https://blog.csdn.net/goldenlegs/article/details/86509806
本来是防止内存泄漏的,在网上找了很多方法对我这个好像没多大作用最后才知道,table头columns动态添加的时候会报这个错误,直接写死