fix(lesson-preparation): 重命名 TreeNodeRow.children prop 为 childItems 避免 react/no-children-prop

This commit is contained in:
SpecialX
2026-07-04 11:36:41 +08:00
parent 8ff14fce1c
commit 85121c49a3
2 changed files with 5 additions and 5 deletions

View File

@@ -100,7 +100,7 @@ export function StructureTree() {
hasChildren={hasChildren} hasChildren={hasChildren}
isChildrenExpanded={isTreeNodeExpanded} isChildrenExpanded={isTreeNodeExpanded}
onToggleChildren={() => toggleTreeNode(node.id)} onToggleChildren={() => toggleTreeNode(node.id)}
children={childItems} childItems={childItems}
/> />
); );
})} })}

View File

@@ -13,7 +13,7 @@ interface Props {
isChildrenExpanded?: boolean; isChildrenExpanded?: boolean;
onToggleChildren?: () => void; onToggleChildren?: () => void;
/** 子节点(如对话轮次) */ /** 子节点(如对话轮次) */
children?: { id: string; label: string; kind: string }[]; childItems?: { id: string; label: string; kind: string }[];
} }
export function TreeNodeRow({ export function TreeNodeRow({
@@ -22,7 +22,7 @@ export function TreeNodeRow({
hasChildren, hasChildren,
isChildrenExpanded, isChildrenExpanded,
onToggleChildren, onToggleChildren,
children, childItems,
}: Props) { }: Props) {
const t = useTranslations("lessonPreparation"); const t = useTranslations("lessonPreparation");
const selectedNodeId = useLessonPlanEditor((s) => s.selectedNodeId); const selectedNodeId = useLessonPlanEditor((s) => s.selectedNodeId);
@@ -116,7 +116,7 @@ export function TreeNodeRow({
)} )}
</div> </div>
{hasChildren && isChildrenExpanded && children && ( {hasChildren && isChildrenExpanded && childItems && (
<div <div
style={{ style={{
marginLeft: 10, marginLeft: 10,
@@ -124,7 +124,7 @@ export function TreeNodeRow({
borderLeft: "1px solid var(--border)", borderLeft: "1px solid var(--border)",
}} }}
> >
{children.map((c) => ( {childItems.map((c) => (
<div <div
key={c.id} key={c.id}
style={{ style={{