js樹型結構資料簡易遞迴
// item內的值根據實際情況更換
replaceValueInTree (tree) { const result = [] tree.forEach((item) => { let children = item.children || [] if (Array.isArray(children) && children.length > 0) { children = this.replaceValueInTree(children) } let newItem = { title: item.categoryName, value: item.id, checked: false, selected: false, children: children } result.push(newItem); }) return result }