chore(examples): cleanup examples

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2022-12-25 16:17:04 +01:00
committed by Braks
parent bac98930da
commit 48c4f0a0eb
4 changed files with 9 additions and 12 deletions
+4 -3
View File
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { VueFlow, isNode, useVueFlow } from '@vue-flow/core'
import type { Elements } from '@vue-flow/core'
import { VueFlow, isNode, useVueFlow } from '@vue-flow/core'
import { Background } from '@vue-flow/background'
import { Controls } from '@vue-flow/controls'
@@ -14,12 +14,13 @@ const elements = ref<Elements>([
{ id: 'e1-2', source: '1', target: '2', animated: true },
{ id: 'e1-3', source: '1', target: '3' },
])
const { onPaneReady, onNodeDragStop, onConnect, addEdges, setTransform, toObject } = useVueFlow({
defaultZoom: 1.5,
const { onNodeDragStop, onConnect, addEdges, setTransform, toObject } = useVueFlow({
minZoom: 0.2,
maxZoom: 4,
connectOnClick: true,
fitViewOnInit: false,
selectionOnDrag: true,
panOnDrag: [2],
})
onNodeDragStop((e) => console.log('drag stop', e))
+2 -2
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import type { Elements, FlowEvents, VueFlowStore } from '@vue-flow/core'
import { VueFlow, addEdge, isNode } from '@vue-flow/core'
import { VueFlow, isNode } from '@vue-flow/core'
import { Background } from '@vue-flow/background'
import { Controls } from '@vue-flow/controls'
@@ -50,7 +50,7 @@ export default defineComponent({
this.instance = instance as any
},
onConnect(params: FlowEvents['connect']) {
addEdge(params, this.elements)
this.instance?.addEdges([params])
},
},
})