Browse Source

解决new Function访问全局变量的问题

master
flowerField 5 years ago
parent
commit
2a11c7d712
  1. 2
      src/controllers/server.js
  2. 6
      src/global/extend.js

2
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;

6
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 {

Loading…
Cancel
Save