From 2a11c7d712c9ae87b55727760384faa6bdc502f7 Mon Sep 17 00:00:00 2001 From: flowerField Date: Fri, 4 Dec 2020 16:47:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3new=20Function=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E5=85=A8=E5=B1=80=E5=8F=98=E9=87=8F=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/server.js | 2 +- src/global/extend.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/controllers/server.js b/src/controllers/server.js index d99d5ed..9edcbe9 100644 --- a/src/controllers/server.js +++ b/src/controllers/server.js @@ -550,7 +550,7 @@ const server = { arr.push(JSON.stringify(addData[i])); } - new Function("return " + 'data.splice(' + st_i + ', 0, ' + arr.join(",") + ')')(); + new Function("data","return " + 'data.splice(' + st_i + ', 0, ' + arr.join(",") + ')')(data); } else{ file["column"] += len; diff --git a/src/global/extend.js b/src/global/extend.js index 624fd7a..6e0b3a2 100644 --- a/src/global/extend.js +++ b/src/global/extend.js @@ -713,14 +713,14 @@ function luckysheetextendtable(type, index, value, direction, sheetIndex) { if(direction == "lefttop"){ if(index == 0){ - new Function("return " + 'd.unshift(' + arr.join(",") + ')')(); + new Function("d","return " + 'd.unshift(' + arr.join(",") + ')')(d); } else{ - new Function("return " + 'd.splice(' + index + ', 0, ' + arr.join(",") + ')')(); + new Function("d","return " + 'd.splice(' + index + ', 0, ' + arr.join(",") + ')')(d); } } else{ - new Function("return " + 'd.splice(' + (index + 1) + ', 0, ' + arr.join(",") + ')')(); + new Function("d","return " + 'd.splice(' + (index + 1) + ', 0, ' + arr.join(",") + ')')(d); } } else {