doc(transfer): tree-transfer disabled style (#6480)

pull/6489/head
Cherry7 2 years ago committed by GitHub
parent bf5fcdc269
commit c690f4188a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -78,14 +78,12 @@ function isChecked(selectedKeys: (string | number)[], eventKey: string | number)
return selectedKeys.indexOf(eventKey) !== -1;
}
function handleTreeData(data: TransferProps['dataSource'], targetKeys: string[] = []) {
data.forEach(item => {
item['disabled'] = targetKeys.includes(item.key as any);
if (item.children) {
handleTreeData(item.children, targetKeys);
}
});
return data as TreeProps['treeData'];
function handleTreeData(treeNodes: TransferProps['dataSource'], targetKeys: string[] = []) {
return treeNodes.map(({ children, ...props }) => ({
...props,
disabled: targetKeys.includes(props.key as string),
children: handleTreeData(children ?? [], targetKeys),
}));
}
export default defineComponent({

Loading…
Cancel
Save