deepCopy(obj) { let target = null if(typeof obj === 'object'){ if(Array.isArray(obj)){ //数组 target = []; obj.forEach(item => { delete item.id delete item.deep delete item.name delete item.pid delete item.pinyin_prefix delete item.pinyin delete item.ext_id target.push(this.deepCopy(item)); }) }else if(obj){ target = {vlaue:'',label:'',children:[]} let objKeys = Object.keys(obj); objKeys=[...objKeys,'ext_name'] objKeys.forEach(key => { if(Array.isArray(this.deepCopy(obj[key]))){ target.children = this.deepCopy(obj[key]); } if(Array.isArray(target.children)&&target.children.length<1){ delete target.children } target.vlaue = this.deepCopy(obj[key]); target.label = this.deepCopy(obj[key]); }) }else{ target = obj } }else{ target = obj; } return target },