chore(pathfinding-edge): update README.md
This commit is contained in:
@@ -1,15 +1,6 @@
|
|||||||
# Vue Flow Pathfinding Edge 🧲
|
# Vue Flow Pathfinding Edge 🧲
|
||||||
|
|
||||||

|
### Custom Edge that avoids crossing other Nodes
|
||||||
[](https://david-dm.org/bcakmakoglu/vue-flow-pathfinding-edge)
|
|
||||||
[](https://david-dm.org/bcakmakoglu/vue-flow-pathfinding-edge?type=dev)
|
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
### **Custom Edge that avoids crossing other Nodes**
|
|
||||||
|
|
||||||
Check the [documentation](https://vueflow.dev/docs/addons/pathfinding) for more info on how to use this custom edge.
|
|
||||||
|
|
||||||
## 🛠 Setup
|
## 🛠 Setup
|
||||||
|
|
||||||
@@ -24,26 +15,20 @@ $ npm i --save @braks/vue-flow-pathfinding-edge
|
|||||||
## 🎮 Quickstart
|
## 🎮 Quickstart
|
||||||
|
|
||||||
```vue
|
```vue
|
||||||
<script lang="ts" setup>
|
<script setup>
|
||||||
import {
|
import { VueFlow, useVueFlow } from '@braks/vue-flow'
|
||||||
VueFlow,
|
|
||||||
Elements,
|
|
||||||
useVueFlow
|
|
||||||
} from '@braks/vue-flow'
|
|
||||||
import { PathFindingEdge } from '@braks/vue-flow-pathfinding-edge'
|
import { PathFindingEdge } from '@braks/vue-flow-pathfinding-edge'
|
||||||
import initialElements from './initial-elements'
|
import initialElements from './initial-elements'
|
||||||
|
|
||||||
const elements = ref<Elements>(initialElements)
|
const elements = ref(initialElements)
|
||||||
|
|
||||||
// create a new context so we can fetch nodes
|
// create a new context so we can fetch nodes
|
||||||
const { getNodes } = useVueFlow({
|
const { getNodes } = useVueFlow()
|
||||||
modelValue: elements.value
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div style="height: 300px">
|
<div style="height: 300px">
|
||||||
<VueFlow>
|
<VueFlow v-model="elements">
|
||||||
<template #edge-pathFinding="props">
|
<template #edge-pathfinding="props">
|
||||||
<PathFindingEdge v-bind="props" :nodes="getNodes" />
|
<PathFindingEdge v-bind="props" :nodes="getNodes" />
|
||||||
</template>
|
</template>
|
||||||
</VueFlow>
|
</VueFlow>
|
||||||
@@ -51,8 +36,8 @@ const { getNodes } = useVueFlow({
|
|||||||
</template>
|
</template>
|
||||||
```
|
```
|
||||||
|
|
||||||
```typescript
|
```js
|
||||||
// initial-elements.ts
|
// initial-elements.js
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
id: '1',
|
id: '1',
|
||||||
@@ -76,7 +61,8 @@ export default [
|
|||||||
target: '2',
|
target: '2',
|
||||||
label: 'Smart Edge',
|
label: 'Smart Edge',
|
||||||
style: { stroke: 'red' },
|
style: { stroke: 'red' },
|
||||||
type: 'pathFinding'
|
// assign pathfinding edge type
|
||||||
|
type: 'pathfinding'
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user