ant-design-vue
ant-design-vue copied to clipboard
Tree组件tree-data属性的TS类型错误
- [ ] I have searched the issues of this repository and believe that this is not a duplicate.
Version
4.1.0
Environment
antd 4.1.0
Reproduction link
Steps to reproduce
<a-tree
:checkable="true"
:fieldNames="replaceFields"
:tree-data="permissionList"
:default-expand-all="true"
:checkStrictly="true"
v-model:checkedKeys="checkedKeys"
/>
tree组件中,我得结果集是permissionList,同时搭配fieldNames一起使用,IDE编译器提示TS类型【DataNode[]】不一致。我看DataNode的key目前是不能为空。
export interface DataNode extends BasicDataNode {
children?: DataNode[];
key: string | number;
title?: any;
}
What is expected?
export interface DataNode extends BasicDataNode {
children?: DataNode[];
key?: string | number;
title?: any;
}
What is actually happening?
export interface DataNode extends BasicDataNode {
children?: DataNode[];
key: string | number;
title?: any;
}
这样使用试下
TreeData对象类型,里面的变量'key'是不能为空的,treedata这样子定义当前代码IDE也会提示,使用filed-name的不就是用来用自定义字段代替'key'吗
确实
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days
我想控制tree树状控件某些节点根据一个响应式来判断css隐藏或者显;但是tree的api似乎没有提供这个
然后我使用default插槽;提示报错
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days