typescript+vue3
function flattenTree(tree:any, result:any) { tree.forEach((node:any) => { result.push({ id: node.id, cat_name: node.cat_name, cat_name_en: node.cat_name_en }); if (node.child.length > 0) { flattenTree(node.child, result); } }); } let fdata1:any=ref([]); flattenTree(res.data.data, fdata1.value);
标签:node,name,递归,JavaScript,cat,例子,result,any,flattenTree From: https://www.cnblogs.com/hechunfeng/p/17457402.html