chore(examples): update examples with new API for add/remove

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-05-11 15:33:42 +02:00
committed by Braks
parent 5610efa470
commit e464d7b8a5
27 changed files with 91 additions and 119 deletions
@@ -1,16 +1,10 @@
<script lang="ts" setup>
import type { Elements, VueFlowStore } from '@vue-flow/core'
import { ConnectionMode, VueFlow, useVueFlow } from '@vue-flow/core'
import type { Elements } from '@vue-flow/core'
import { VueFlow, useVueFlow } from '@vue-flow/core'
import { Controls } from '@vue-flow/controls'
import '@vue-flow/controls/dist/style.css'
import Sidebar from './Sidebar.vue'
function onLoad(flowInstance: VueFlowStore) {
return console.log('flow loaded:', flowInstance)
}
const initialElements: Elements = [
{ id: '1', type: 'input', label: 'Node 1', position: { x: 250, y: 5 } },
{ id: '2', label: 'Node 2', position: { x: 100, y: 100 } },
@@ -21,14 +15,16 @@ const initialElements: Elements = [
]
useVueFlow()
const elements = ref<Elements>(initialElements)
</script>
<template>
<div class="providerflow">
<Sidebar />
<div class="vue-flow-wrapper">
<VueFlow v-model="elements" :connection-mode="ConnectionMode.Loose" @pane-ready="onLoad">
<VueFlow v-model="elements">
<Controls />
</VueFlow>
</div>