我正在使用antD树组件。我有一个树结构,节点可以是目录或文件类型。我想用粗体显示目录的名称。有办法通过json定义为Tree项指定类吗?
发布于 2022-11-21 10:04:13
您可以将标题指定为树的JSON-config中的react组件:
const treeData: DataNode[] = [
{
title: <span>{<RightCircleOutlined />} parent</span>, //icon added here
key: '0-0',
children: [
{
title: 'parent 1-0',
key: '0-0-0',
disabled: true,
children: [
{
title: 'leaf',
key: '0-0-0-0',
disableCheckbox: true,
},
{
title: 'leaf',
key: '0-0-0-1',
},
],
},
{
title: 'parent 1-1',
key: '0-0-1',
children: [{ title: <span style={{ color: '#1890ff' }}>sss</span>, key: '0-0-1-0' }],
},
],
},
];这个例子来自于我的答案here
https://stackoverflow.com/questions/74502183
复制相似问题