doc(transfer): tree-transfer disabled style (#6480)
parent
bf5fcdc269
commit
c690f4188a
|
@ -78,14 +78,12 @@ function isChecked(selectedKeys: (string | number)[], eventKey: string | number)
|
||||||
return selectedKeys.indexOf(eventKey) !== -1;
|
return selectedKeys.indexOf(eventKey) !== -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleTreeData(data: TransferProps['dataSource'], targetKeys: string[] = []) {
|
function handleTreeData(treeNodes: TransferProps['dataSource'], targetKeys: string[] = []) {
|
||||||
data.forEach(item => {
|
return treeNodes.map(({ children, ...props }) => ({
|
||||||
item['disabled'] = targetKeys.includes(item.key as any);
|
...props,
|
||||||
if (item.children) {
|
disabled: targetKeys.includes(props.key as string),
|
||||||
handleTreeData(item.children, targetKeys);
|
children: handleTreeData(children ?? [], targetKeys),
|
||||||
}
|
}));
|
||||||
});
|
|
||||||
return data as TreeProps['treeData'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
|
Loading…
Reference in New Issue