fix: use local refs for nodes/edges, only useVueFlow for events and fitView
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { watch, nextTick } from 'vue'
|
||||
import { ref, watch, nextTick } from 'vue'
|
||||
import { VueFlow, useVueFlow } from '@vue-flow/core'
|
||||
import { Background } from '@vue-flow/background'
|
||||
import { Controls } from '@vue-flow/controls'
|
||||
@@ -20,7 +20,9 @@ const emit = defineEmits<{
|
||||
addEdge: [source: string, target: string]
|
||||
}>()
|
||||
|
||||
const { nodes, edges, onNodeClick, onConnect, fitView } = useVueFlow()
|
||||
const nodes = ref<any[]>([])
|
||||
const edges = ref<any[]>([])
|
||||
const { onNodeClick, onConnect, fitView } = useVueFlow()
|
||||
|
||||
function makeNodes() {
|
||||
return props.sceneNodes.map((n, i) => ({
|
||||
@@ -99,6 +101,8 @@ onConnect((conn: Connection) => {
|
||||
<template>
|
||||
<div class="scene-graph">
|
||||
<VueFlow
|
||||
:nodes="nodes"
|
||||
:edges="edges"
|
||||
:min-zoom="0.2"
|
||||
:max-zoom="2"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user