Skip to content

Commit b101bf8

Browse files
committed
chore(examples): cleanup
Signed-off-by: braks <[email protected]>
1 parent 5209fca commit b101bf8

File tree

1 file changed

+6
-25
lines changed

1 file changed

+6
-25
lines changed

examples/vite/src/Basic/Basic.vue

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,12 @@ const elements = ref<Elements>([
1212
{ id: '3', label: 'Node 3', position: { x: 400, y: 100 }, class: 'light' },
1313
{ id: '4', label: 'Node 4', position: { x: 400, y: 200 }, class: 'light' },
1414
{ id: 'e1-2', source: '1', target: '2', animated: true },
15-
{ id: 'e1-3', source: '1', target: '3' },
15+
{ id: 'e1-3', source: '1', target: '5' },
1616
])
17-
const { onNodeDragStop, onEdgeClick, onConnect, addEdges, setTransform, toObject, fitView, onPaneReady, setNodes, setEdges } =
18-
useVueFlow({
19-
minZoom: 0.2,
20-
maxZoom: 4,
21-
connectOnClick: true,
22-
fitViewOnInit: false,
23-
})
17+
const { onNodeDragStop, onEdgeClick, onConnect, addEdges, setTransform, toObject } = useVueFlow({
18+
minZoom: 0.2,
19+
maxZoom: 4,
20+
})
2421
2522
onNodeDragStop((e) => console.log('drag stop', e.event))
2623
onEdgeClick(console.log)
@@ -36,29 +33,13 @@ const updatePos = () =>
3633
}
3734
})
3835
39-
onPaneReady((instance) => {
40-
setNodes([
41-
{ id: '1', type: 'input', label: 'Node 1', position: { x: 250, y: 5 }, class: 'light' },
42-
{ id: '2', label: 'Node 2', position: { x: 100, y: 100 }, class: 'light' },
43-
{ id: '3', label: 'Node 3', position: { x: 400, y: 100 }, class: 'light' },
44-
{ id: '4', label: 'Node 4', position: { x: 400, y: 200 }, class: 'light' },
45-
])
46-
47-
setEdges([
48-
{ id: 'e1-2', source: '1', target: '2', animated: true },
49-
{ id: 'e1-3', source: '1', target: '3' },
50-
])
51-
52-
instance.fitView()
53-
})
54-
5536
const logToObject = () => console.log(toObject())
5637
const resetTransform = () => setTransform({ x: 0, y: 0, zoom: 1 })
5738
const toggleclass = () => elements.value.forEach((el) => (el.class = el.class === 'light' ? 'dark' : 'light'))
5839
</script>
5940

6041
<template>
61-
<VueFlow v-model="elements" connection-mode="strict" class="vue-flow-basic-example">
42+
<VueFlow v-model="elements" fit-view-on-init connection-mode="strict" class="vue-flow-basic-example">
6243
<Background />
6344
<MiniMap />
6445
<Controls />

0 commit comments

Comments
 (0)