MCPcopy Create free account
hub / github.com/MankaiHuang/screen-visualization / getPathByKey

Function getPathByKey

public/iframe/lib/js/commonFun.js:87–99  ·  view source on GitHub ↗
(arr, key, value)

Source from the content-addressed store, hash-verified

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);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected