From a2024a9827b398e66a3a58346e137e2bc386730c Mon Sep 17 00:00:00 2001 From: gx Date: Thu, 18 Mar 2021 16:37:51 +0800 Subject: [PATCH] fix: check if trs and action exist in doEventList --- build/TableHeader.js | 6 ++++-- package.json | 2 +- src/TableHeader.js | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/build/TableHeader.js b/build/TableHeader.js index b23c199..07f3fab 100644 --- a/build/TableHeader.js +++ b/build/TableHeader.js @@ -220,8 +220,10 @@ var TableHeader = function (_Component) { }; TableHeader.prototype.doEventList = function doEventList(trs, action) { - for (var index = 0; index < trs.length; index++) { - action(trs[index]); + if (trs && Array.isArray(trs) && action) { + for (var index = 0; index < trs.length; index++) { + action(trs[index]); + } } }; diff --git a/package.json b/package.json index 099f06f..54bf8db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bee-table", - "version": "2.3.15-beta.12", + "version": "2.3.15-beta.13", "description": "Table ui component for react", "keywords": [ "react", diff --git a/src/TableHeader.js b/src/TableHeader.js index 38b7f56..3cafeed 100644 --- a/src/TableHeader.js +++ b/src/TableHeader.js @@ -171,8 +171,10 @@ class TableHeader extends Component { doEventList(trs,action){ - for (let index = 0; index < trs.length; index++) { - action(trs[index]); + if (trs && Array.isArray(trs) && action) { + for (let index = 0; index < trs.length; index++) { + action(trs[index]); + } } }