-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tree): 利用getChildContext将Tree组件获取到的node节点通过context传给TreeNode组件
- Loading branch information
beth
committed
May 19, 2018
1 parent
8560bb6
commit f270360
Showing
3 changed files
with
91 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Children } from 'react'; | ||
|
||
export const toArray = (myObj) => { | ||
const array = myObj.map((value, index) => { | ||
return [value]; | ||
}); | ||
|
||
console.log(array); | ||
return array; | ||
} | ||
|
||
export const getNodeChildren = (children) => { | ||
const childList = Array.isArray(children) ? children : [children]; | ||
return childList | ||
.filter(child => child && child.type && child.type.isTreeNode); | ||
} |