File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @vue-flow/core " : minor
3
+ ---
4
+
5
+ Add ` useNodesData ` composable
6
+
7
+ ## 🧙 Example
8
+
9
+ ### Single node id
10
+
11
+ ``` ts
12
+ const nodeId = ' 1'
13
+
14
+ const data = useNodesData (nodeId )
15
+
16
+ console .log (data .value ) // '[{ /* ... */ }]
17
+ ```
18
+
19
+ ### Array of node ids
20
+ ``` ts
21
+ const nodeIds = [' 1' , ' 2' , ' 3' ]
22
+
23
+ const data = useNodesData (nodeIds )
24
+
25
+ console .log (data .value ) // '[{ /* ... */ }]
26
+ ```
27
+
28
+ ### Asserting data type
29
+ ``` ts
30
+ import type { Node } from ' @vue-flow/core'
31
+
32
+ interface Data {
33
+ foo: string ;
34
+ bar: string ;
35
+ }
36
+
37
+ type MyNode = Node <CustomNodeData >
38
+
39
+ const nodeId = ' 1'
40
+
41
+ const data = useNodesData ([nodeId ], (node ): node is MyNode => {
42
+ return ' foo' in node .data && ' bar' in node .data
43
+ })
44
+
45
+ console .log (data .value ) // '[{ /* foo: string; bar: string */ }]
46
+ ```
You can’t perform that action at this time.
0 commit comments