chore(docs): add state injection section to useVueFlow docs

This commit is contained in:
braks
2024-06-13 11:17:24 +02:00
parent 6345176b25
commit fe55415b2d
3 changed files with 40 additions and 11 deletions
+14 -10
View File
@@ -136,7 +136,7 @@ Sidebar or Toolbar.
<script setup>
import { ref } from 'vue'
import { VueFlow, useVueFlow } from '@vue-flow/core'
import { Panel, VueFlow, useVueFlow } from '@vue-flow/core'
const initialNodes = ref([
{
@@ -167,10 +167,12 @@ function onAddNodes() {
</script>
<template>
<VueFlow :nodes="initialNodes" />
<button type="button" @click="onAddNode">Add a node</button>
<button type="button" @click="onAddNodes">Add multiple nodes</button>
<VueFlow :nodes="initialNodes">
<Panel>
<button type="button" @click="onAddNode">Add a node</button>
<button type="button" @click="onAddNodes">Add multiple nodes</button>
</Panel>
</VueFlow>
</template>
```
@@ -178,7 +180,7 @@ function onAddNodes() {
<script setup lang="ts">
import { ref } from 'vue'
import type { Node } from '@vue-flow/core'
import { VueFlow, useVueFlow } from '@vue-flow/core'
import { Panel, VueFlow, useVueFlow } from '@vue-flow/core'
const initialNodes = ref<Node[]>([
{
@@ -213,10 +215,12 @@ function onAddNodes() {
</script>
<template>
<VueFlow :nodes="initialNodes" />
<button type="button" @click="onAddNode()">Add a node</button>
<button type="button" @click="onAddNodes()">Add multiple nodes</button>
<VueFlow :nodes="initialNodes">
<Panel>
<button type="button" @click="onAddNode">Add a node</button>
<button type="button" @click="onAddNodes">Add multiple nodes</button>
</Panel>
</VueFlow>
</template>
```