@ -36,7 +36,7 @@ const App: React.FC = () => {
const onDragEnter : TreeProps [ 'onDragEnter' ] = ( info ) = > {
const onDragEnter : TreeProps [ 'onDragEnter' ] = ( info ) = > {
console . log ( info ) ;
console . log ( info ) ;
// expandedKeys 需要受控时设置
// expandedKeys , set it when controlled is needed
// setExpandedKeys(info.expandedKeys)
// setExpandedKeys(info.expandedKeys)
} ;
} ;
@ -74,7 +74,7 @@ const App: React.FC = () => {
// Drop on the content
// Drop on the content
loop ( data , dropKey , ( item ) = > {
loop ( data , dropKey , ( item ) = > {
item . children = item . children || [ ] ;
item . children = item . children || [ ] ;
// where to insert 示例添加到头部,可以是随意位置
// where to insert . New item was inserted to the start of the array in this example, but can be anywhere
item . children . unshift ( dragObj ) ;
item . children . unshift ( dragObj ) ;
} ) ;
} ) ;
} else if (
} else if (
@ -84,7 +84,7 @@ const App: React.FC = () => {
) {
) {
loop ( data , dropKey , ( item ) = > {
loop ( data , dropKey , ( item ) = > {
item . children = item . children || [ ] ;
item . children = item . children || [ ] ;
// where to insert 示例添加到头部,可以是随意位置
// where to insert . New item was inserted to the start of the array in this example, but can be anywhere
item . children . unshift ( dragObj ) ;
item . children . unshift ( dragObj ) ;
// in previous version, we use item.children.push(dragObj) to insert the
// in previous version, we use item.children.push(dragObj) to insert the
// item to the tail of the children
// item to the tail of the children