(arr, key, value)
| 85 | return result; |
| 86 | }, |
| 87 | getPathByKey(arr, key, value) { |
| 88 | // arr为树形结构数组,value为要查询的树节点的标识值,key则为标识 |
| 89 | // 获取指定节点的路径数组 |
| 90 | // 用于存储节点唯一标识值路径数组 |
| 91 | this.nodePathArray = []; |
| 92 | try { |
| 93 | for (let i = 0; i < arr.length; i++) { |
| 94 | this.getNodePath(arr[i], key, value); |
| 95 | } |
| 96 | } catch (e) { |
| 97 | return this.nodePathArray; |
| 98 | } |
| 99 | }, |
| 100 | getNodePath(node, key, value) { |
| 101 | // 这里可以自定义push的内容,而不是整个node,而且这里node也包含了children |
| 102 | this.nodePathArray.push(node.property.elementId); |
nothing calls this directly
no outgoing calls
no test coverage detected