-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
45 lines (45 loc) · 1005 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!doctype html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>@ifake/tree-path example</title>
</head>
<body>
<h1 style="text-align: center;">Development environment.(Open browser console)</h1>
<!-- Run in local serve -->
<script src="dist/index.umd.js"></script>
<script>
const { treePath } = IFakeTP
const data = [
{
id: 1,
child: [
{
id: '1-1'
},
{
id: '1-2',
child: [
{
id: '1-2-1'
}
]
}
]
},
{
id: 2
}
]
const result = treePath({
tree: data,
childrenKey: 'child',
breakCondition: node => node.id === '1-1'
})
console.log(result)
</script>
</body>
</html>