Skip to content

Commit

Permalink
fix(module:tree-select): 修复回显顺序问题 (#8108)
Browse files Browse the repository at this point in the history
  • Loading branch information
EnochGao authored Nov 17, 2023
1 parent 0254ee2 commit eb4077d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion components/tree-select/tree-select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,22 @@ export class NzTreeSelectComponent extends NzTreeBase implements ControlValueAcc
}
}

this.selectedNodes = [...(this.nzCheckable ? this.getCheckedNodeList() : this.getSelectedNodeList())];
this.selectedNodes = [...(this.nzCheckable ? this.getCheckedNodeList() : this.getSelectedNodeList())].sort(
(a, b) => {
const indexA = this.value.indexOf(a.key);
const indexB = this.value.indexOf(b.key);
if (indexA !== -1 && indexB !== -1) {
return indexA - indexB;
}
if (indexA !== -1) {
return -1;
}
if (indexB !== -1) {
return 1;
}
return 0;
}
);
}

updatePosition(): void {
Expand Down

0 comments on commit eb4077d

Please sign in to comment.