-1
var data = {Shop : "Shopename", email : "email@gmail.com", name : "name"},{Shop : "Shopename2", email : "email2@gmail.com", name : "name2"};

var data2exportforexcel =[data];
//wanted data
  [{Shop : "Shopename", email : "email@gmail.com", name : "name"},{Shop : "Shopename2", email : "email2@gmail.com", name : "name2"}];

//我得到的数据

[ '{Shop : "Shopename", email : "email@gmail.com", name : "name"},{Shop : "Shopename2", email : "email2@gmail.com", name : "name2"}'];

尝试在 data2exportforexcel 上替换。但说它不是函数。

我正在将数据动态获取到数据变量,以便使用 mongoxls 插件将其导出到节点 js mongodb 中的 excel

4

1 回答 1

0

你试过这个吗?

var data2exportforexcel = [JSON.parse(data)];
于 2018-01-14T14:42:27.970 回答