ant-design-vue icon indicating copy to clipboard operation
ant-design-vue copied to clipboard

a-tree 组件的 TreeProps['treeData'] 类型报错

Open huangmingfu opened this issue 6 months ago • 0 comments
trafficstars

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Version

4.2.6

Environment

mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/128.0.0.0 safari/537.36

Reproduction link

https://www.antdv.com/components/tree-cn#api

Steps to reproduce

它必须需要一个 key 字段,复现demo

Image

但是我用 fieldNames 指定替换了它的 keyid

const fieldNames: TreeProps['fieldNames'] = {
children: 'child',
title: 'name',
key:'id'
};

Image

What is expected?

不报ts类型错误

What is actually happening?

报数据类型不符合TreeProps['treeData'] 错误,缺少 key 属性

huangmingfu avatar May 20 '25 02:05 huangmingfu