提交 0f7657a4 authored 作者: 姚鑫国's avatar 姚鑫国

优化 upObjKey 函数

上级 df7cd9cf
...@@ -758,9 +758,11 @@ export function upObjKey(obj, setKey = {}, defaultValue = "") { ...@@ -758,9 +758,11 @@ export function upObjKey(obj, setKey = {}, defaultValue = "") {
obj, e, newKey, type, timeFormat, defaultValue obj, e, newKey, type, timeFormat, defaultValue
}) })
}; };
if (e != newKey) {
delete nowObj[e]; delete nowObj[e];
} }
} }
}
if (objType === "[object Array]" && Array.isArray(obj) && obj.length > 0) { if (objType === "[object Array]" && Array.isArray(obj) && obj.length > 0) {
nowObj = new Array(); nowObj = new Array();
obj.forEach((v, i, arr) => { obj.forEach((v, i, arr) => {
...@@ -774,8 +776,10 @@ export function upObjKey(obj, setKey = {}, defaultValue = "") { ...@@ -774,8 +776,10 @@ export function upObjKey(obj, setKey = {}, defaultValue = "") {
obj: v, e, newKey, type, timeFormat, defaultValue obj: v, e, newKey, type, timeFormat, defaultValue
}) })
}; };
if (e != newKey) {
delete newJson[e]; delete newJson[e];
} }
}
nowObj.push(newJson); nowObj.push(newJson);
}) })
} }
...@@ -821,6 +825,7 @@ function getSetKeyJson({ ...@@ -821,6 +825,7 @@ function getSetKeyJson({
// delete obj[e]; // delete obj[e];
switch (type) { switch (type) {
case "time": case "time":
debugger
newKeyObj[newKey] = (timeFormat && value ? moment(value).format(timeFormat) : value) || defaultValue; newKeyObj[newKey] = (timeFormat && value ? moment(value).format(timeFormat) : value) || defaultValue;
break; break;
default: default:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论