antd 之 Warning: children of Tree is deprecated. Please use treeData instead

antd 4.0版本以前,使用tree控件方法和4.0之後不相同。因此,如果3.0升級到4.0遇到標題這樣的問題。只需要將Tree屬性設置數據即可。

3.0 寫法

<Tree
    onSelect={this.onSelect}
    onExpand={this.onExpand}
    expandedKeys={expandedKeys}
    autoExpandParent={autoExpandParent}
>
    { resData.length>0 ? loop(resData) : ""}
</Tree>

4.0 寫法

<Tree
    onSelect={this.onSelect}
    onExpand={this.onExpand}
    expandedKeys={expandedKeys}
    autoExpandParent={autoExpandParent}
    treeData={resData}
>
</Tree>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章