fromJSON是NavEdge对象的一个方法,用于将JSON格式的字符串转换为NavEdge对象。
NavEdge.fromJSON(jsonString)
返回转换后的NavEdge对象。
const jsonString = '{"name": "Home", "children": [{"name": "Kitchen", "children": []}, {"name": "Bedroom", "children": [{"name": "Closet", "children": []}]}]}';
const navEdge = NavEdge.fromJSON(jsonString);
console.log(navEdge);
NavEdge {name: "Home", children: Array(2)}
children: Array(2)
0: NavEdge {name: "Kitchen", children: Array(0)}
1:
children: Array(1)
0: NavEdge {name: "Closet", children: Array(0)}
name: "Bedroom"
__proto__: Object
name: "Home"
__proto__: Object