React antd tree如何在title后添加Rate组件

img


如图,如何在项目名称后加入Rate组件,数据结构如下:



```javascript
const testData = [
    {
        title: 'Samsung 16G&32G 18nm 2666  1Rx4 RDIMM',
        key: '0-0',
    },
    {
        title: '键盘鼠标项目',
        key: '0-1',
        children: [
            {
                title: '海光平台UOS兼容性',
                key: '0-1-0',
                isLeaf: true,
            },
            {
                title: '五亭桥_L300-G35S(四期)',
                key: '0-1-1',
                isLeaf: true,
            },
        ],
    },
    {
        title: 'SR02-A1061R M.2 RAID卡引入',
        key: '0-2',
    },
    {
        title: '康舒CRPS1300D白金1300W CRPS电源模块',
        key: '0-3',
    },
]


应该可以自定义

img

将title 设置为node类型

const desc = ['terrible', 'bad', 'normal', 'good', 'wonderful'];
[{
   key: '重量', selectable: false, value: '重量',
    title: (
      <span style={{ color: '#212529' }} >
        重量
      </span><Rate style={{marginLeft:'18px'}} tooltips={desc}  value="3" /></>
    ),}]

img

最终效果

img