update(examples): Update stress example syntax
This commit is contained in:
@@ -1,16 +1,21 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { VueFlow, FlowInstance } from '@braks/vue-flow'
|
import { VueFlow, useVueFlow } from '@braks/vue-flow'
|
||||||
import { getElements } from './utils'
|
import { getElements } from './utils'
|
||||||
|
|
||||||
const instance = ref<FlowInstance>()
|
|
||||||
const onLoad = (flowInstance: FlowInstance) => {
|
|
||||||
flowInstance.fitView()
|
|
||||||
instance.value = flowInstance
|
|
||||||
console.log(flowInstance.getNodes())
|
|
||||||
}
|
|
||||||
|
|
||||||
const { nodes, edges } = getElements(10, 10)
|
const { nodes, edges } = getElements(10, 10)
|
||||||
|
|
||||||
|
const { getNode, onPaneReady } = useVueFlow({
|
||||||
|
nodes,
|
||||||
|
edges,
|
||||||
|
})
|
||||||
|
|
||||||
|
onPaneReady((i) => {
|
||||||
|
i.fitView({
|
||||||
|
padding: 0.2,
|
||||||
|
})
|
||||||
|
console.log(i.getElements())
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VueFlow :nodes="nodes" :edges="edges" @pane-ready="onLoad"> </VueFlow>
|
<VueFlow />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user