复用界面树组件计数值
在同一行中复用组件数量,避免重复计算。
This commit is contained in:
@@ -103,6 +103,7 @@ function TreeRow({
|
||||
const data = node.data;
|
||||
const nodeLabel = data.metadata.name || '未命名节点';
|
||||
const isVisible = isNodeVisible(data.id);
|
||||
const componentCount = data.component ? 1 : 0;
|
||||
return (
|
||||
<div
|
||||
ref={dragHandle}
|
||||
@@ -143,8 +144,8 @@ function TreeRow({
|
||||
</span>
|
||||
<span
|
||||
className="inline-flex shrink-0 items-center gap-0.5 rounded-md bg-black/5 px-1 py-0.5 text-[10px] leading-none text-(--platform-text-soft)"
|
||||
title={`${data.component ? 1 : 0} 个组件`}
|
||||
aria-label={`${data.component ? 1 : 0} 个组件`}
|
||||
title={`${componentCount} 个组件`}
|
||||
aria-label={`${componentCount} 个组件`}
|
||||
>
|
||||
<Puzzle
|
||||
size={11}
|
||||
@@ -153,7 +154,7 @@ function TreeRow({
|
||||
strokeWidth={1.5}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span>{data.component ? 1 : 0}</span>
|
||||
<span>{componentCount}</span>
|
||||
</span>
|
||||
<span className="absolute inset-y-0 right-2 flex w-[52px] items-center justify-end gap-1 bg-inherit">
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user