vue xlsx 解析表头为汉字,按要求转换成字段code:
var map = {"名字":"杰克", "性别": "男"};
var codeName = {"名字": "name", "性别": "grade"};
var mapto = {};
for (key in map) {
undefined != codeName[key] ? mapto[codeName[key]] = map[key] : console.log(key + "不存在对应关系");
}
console.log(mapto); // {"name": "杰克", "grade": "男"}