Sign in

简柏林 / thingskit-front · Files

GitLab

  • Go to dashboard
  • Project
  • Activity
  • Files
  • Commits
  • Builds 0
  • Graphs
  • Milestones
  • Issues 0
  • Merge Requests 0
  • Labels
  • Wiki
  • Network
  • thingskit-front
  • src
  • utils
  • fnUtils.ts
  • fix(front):'优化代码'
    81eba1ad
    sqy authored
    2021-11-23 14:26:50 +0800  
    Browse Files »
fnUtils.ts 347 Bytes
Raw Blame History Permalink
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
export const copyTransFun = (arr: any[]) => {
  arr.forEach((item) => {
    if (item.name) {
      item.label = item.name;
      delete item.name;
    }
    if (item.id) {
      item.value = item.id;
      delete item.id;
    }
    if (item.children) {
      if (item.children.length) {
        copyTransFun(item.children);
      }
    }
  });
};