task-279(验收反馈): 修复类目树子级挂错父级(根级loadMore id=-1与父级1的合成节点撞node-key,合成id改独立负数域)

This commit is contained in:
2026-09-06 02:33:51 +08:00
parent 648935e757
commit 3dd39bba44
2 changed files with 20 additions and 2 deletions
@@ -165,7 +165,9 @@ export function makeCategoryLoadMoreNode(
loadedCount: number,
totalCount: number,
): CategoryLoadMoreNode {
const syntheticId = parentId ? -parentId : -1
// 合成 id 独立负数域(-2_000_000 以下):父级 id=1 时 -parentId=-1 会与根级(-1)撞 key
// el-tree node-key 重复会致节点状态错位(子级挂错父级)。placeholder 域(-1_000_000)与此错开。
const syntheticId = -(parentId ?? 0) - 2_000_000
return {
id: syntheticId,
parentId,