masterComponents
有没有办法在文档中没有实例的情况下进行遍历?
此外,当组件更新时,组件的 UUID 是否会发生变化,并且该 UUID 在该组件的所有使用者中是否相同?
弄清楚了。为它写了一个实用函数
export function traverse(node: any) {
if ("children" in node) {
if (node.type !== "INSTANCE") {
for (const child of node.children) {
traverse(child)
if (child.mainComponent) {
console.log(`name: ${child.mainComponent.name}`)
console.log(`key: ${child.mainComponent.key}`)
}
}
}
}
}