docs: move examples dir out of components dir
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<script setup>
|
||||
import { Panel, VueFlow, useVueFlow } from '@vue-flow/core'
|
||||
import { Background, BackgroundVariant } from '@vue-flow/background'
|
||||
import { MiniMap } from '@vue-flow/minimap'
|
||||
|
||||
const { nodes, addNodes, addEdges, onConnect, dimensions } = useVueFlow()
|
||||
|
||||
onConnect((params) => addEdges(params))
|
||||
|
||||
function addRandomNode() {
|
||||
const nodeId = (nodes.value.length + 1).toString()
|
||||
|
||||
const newNode = {
|
||||
id: nodeId,
|
||||
label: `Node: ${nodeId}`,
|
||||
position: { x: Math.random() * dimensions.value.width, y: Math.random() * dimensions.value.height },
|
||||
}
|
||||
|
||||
addNodes([newNode])
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VueFlow>
|
||||
<MiniMap />
|
||||
|
||||
<Background :variant="BackgroundVariant.Lines" />
|
||||
|
||||
<Panel position="top-right">
|
||||
<button type="button" @click="addRandomNode">add node</button>
|
||||
</Panel>
|
||||
</VueFlow>
|
||||
</template>
|
||||
@@ -0,0 +1 @@
|
||||
export { default as EmptyApp } from './App.vue?raw'
|
||||
Reference in New Issue
Block a user