(node)
| 120 | // 因为存在children的情况 因此这里要遍历所有元素去查找 |
| 121 | const nowTemplate = [] |
| 122 | const find = (node) => { // 匿名函数防止this指向错误 |
| 123 | node.some(item => { |
| 124 | const { type, componentsType, option, children, elementId } = item.property |
| 125 | if (type !== 'group') { |
| 126 | if (elementId === id) { |
| 127 | nowTemplate.push(item); |
| 128 | return true |
| 129 | } |
| 130 | if (componentsType === "private") { |
| 131 | // 如果是私有组件 则取 option.templatelist |
| 132 | find(option.templateList) |
| 133 | } |
| 134 | } |
| 135 | if (type === 'group' && children.length > 0) { |
| 136 | find(children) |
| 137 | } |
| 138 | |
| 139 | }) |
| 140 | } |
| 141 | find(templateList) |
| 142 | if (nowTemplate.length > 0) { |
| 143 | return nowTemplate[0] |
no outgoing calls
no test coverage detected