Skip to content

Commit

Permalink
feat: Need to handle deep objects otherwise it will return :[object O…
Browse files Browse the repository at this point in the history
…bject]
  • Loading branch information
赵思 committed Feb 10, 2023
1 parent 4f1e85b commit df5e1ee
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/utils/dataExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ export default function (
const extractObj = (obj) => {
if (typeof obj !== 'object') return [obj];

// 需要处理深层对象 不然会返回:[object Object]
const kes = Object.keys(obj);
kes.forEach((key) => {
const itemValue = obj[key];
if (typeof itemValue === 'object') {
obj[key] = JSON.stringify(itemValue);
}
});

return Object.values(obj);
};

Expand Down

0 comments on commit df5e1ee

Please sign in to comment.