update(examples): correct examples

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2021-12-20 19:29:52 +01:00
parent b12863f297
commit 445718d6f4
32 changed files with 206 additions and 397 deletions
+8 -10
View File
@@ -1,22 +1,20 @@
<script lang="ts" setup>
import Controls from './Controls.vue'
import { VueFlow, addEdge, Connection, Edge, Elements } from '~/index'
import './save.css'
import { VueFlow, Elements } from '~/index'
const initialElements: Elements = [
{ id: '1', data: { label: 'Node 1' }, position: { x: 100, y: 100 } },
{ id: '2', data: { label: 'Node 2' }, position: { x: 100, y: 200 } },
{ id: '1', label: 'Node 1', position: { x: 100, y: 100 } },
{ id: '2', label: 'Node 2', position: { x: 100, y: 200 } },
{ id: 'e1-2', source: '1', target: '2' },
]
const elements = ref(initialElements)
const onConnect = (params: Connection | Edge) => (elements.value = addEdge(params, elements.value))
const onRestore = (els: Elements) => (elements.value = els)
</script>
<template>
<VueFlow v-model="elements" storage-key="vue-flow-123" @connect="onConnect">
<Controls @restore="onRestore" />
<VueFlow v-model="elements">
<Controls />
</VueFlow>
</template>
<style>
@import './save.css';
</style>