Skip to content

Commit 8ce3e03

Browse files
committed
chore(docs): update hidden example
1 parent f5b3d83 commit 8ce3e03

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

docs/examples/hidden/App.vue

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
11
<script setup>
2-
import { Background } from '@vue-flow/background'
3-
import { Panel, VueFlow, useVueFlow } from '@vue-flow/core'
42
import { ref, watch } from 'vue'
3+
import { Background } from '@vue-flow/background'
4+
import { Panel, VueFlow } from '@vue-flow/core'
55
6-
const isHidden = ref(false)
6+
const nodes = ref([
7+
{ id: '1', type: 'input', label: 'Node 1', position: { x: 250, y: 5 } },
8+
{ id: '2', label: 'Node 2', position: { x: 100, y: 100 } },
9+
{ id: '3', label: 'Node 3', position: { x: 400, y: 100 } },
10+
{ id: '4', label: 'Node 4', position: { x: 400, y: 200 } },
11+
])
712
8-
const { nodes, edges } = useVueFlow({
9-
nodes: [
10-
{ id: '1', type: 'input', label: 'Node 1', position: { x: 250, y: 5 } },
11-
{ id: '2', label: 'Node 2', position: { x: 100, y: 100 } },
12-
{ id: '3', label: 'Node 3', position: { x: 400, y: 100 } },
13-
{ id: '4', label: 'Node 4', position: { x: 400, y: 200 } },
14-
],
15-
edges: [
16-
{ id: 'e1-2', source: '1', target: '2' },
17-
{ id: 'e1-3', source: '1', target: '3' },
18-
{ id: 'e3-4', source: '3', target: '4' },
19-
],
20-
})
13+
const edges = ref([
14+
{ id: 'e1-2', source: '1', target: '2' },
15+
{ id: 'e1-3', source: '1', target: '3' },
16+
{ id: 'e3-4', source: '3', target: '4' },
17+
])
18+
19+
const isHidden = ref(false)
2120
2221
watch(isHidden, () => {
23-
nodes.value.forEach((n) => (n.hidden = isHidden.value))
24-
edges.value.forEach((e) => (e.hidden = isHidden.value))
22+
nodes.value = nodes.value.map((node) => ({ ...node, hidden: isHidden.value }))
23+
edges.value = edges.value.map((edge) => ({ ...edge, hidden: isHidden.value }))
2524
})
2625
</script>
2726

2827
<template>
29-
<VueFlow fit-view-on-init>
28+
<VueFlow :nodes="nodes" :edges="edges" fit-view-on-init>
3029
<Background />
3130

3231
<Panel position="top-right">

0 commit comments

Comments
 (0)