chore: update README.md

This commit is contained in:
braks
2024-02-21 13:31:37 +01:00
parent e64ab352e8
commit c24287d4fc
+25 -23
View File
@@ -2,16 +2,16 @@
[![Vue flow](vue-flow.gif)](https://vueflow.dev/) [![Vue flow](vue-flow.gif)](https://vueflow.dev/)
![top-language](https://img.shields.io/github/languages/top/bcakmakoglu/vue-flow) ![top-language](https://img.shields.io/github/languages/top/bcakmakoglu/vue-flow)
![vulnerabilities](https://img.shields.io/snyk/vulnerabilities/github/bcakmakoglu/vue-flow)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/bcakmakoglu/vue-flow) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/bcakmakoglu/vue-flow)
![GitHub last commit](https://img.shields.io/github/last-commit/bcakmakoglu/vue-flow) ![GitHub last commit](https://img.shields.io/github/last-commit/bcakmakoglu/vue-flow)
__Vue Flow: A highly customizable Vue 3 Flowchart component.__ __Vue Flow: A highly customizable Vue 3 Flowchart component.__
With Vue Flow, you can build your own, customized node-based applications like static diagrams or even more complex and Vue Flow is a bridge to the world of interactive flowcharts and graphs, empowering you to bring
interactive editors! interactivity to your graphic representations. Whether it's crafting personal diagrams, generating dynamic
editors, or anything else your imagination conjures up, Vue Flow has you covered.
You can find a detailed explanation of how to get started in the [documentation](https://vueflow.dev/guide/) or check You can find a detailed explanation on how to get started [here](https://vueflow.dev/guide/) or jump right into
the [examples](https://vueflow.dev/examples/). the [examples](https://vueflow.dev/examples/).
## Table of contents ## Table of contents
@@ -61,38 +61,40 @@ the [examples](https://vueflow.dev/examples/).
```bash ```bash
$ npm i @vue-flow/core $ npm i @vue-flow/core
# or
$ pnpm i @vue-flow/core
# or # or
$ yarn add @vue-flow/core $ yarn add @vue-flow/core
``` ```
## 🎮 Quickstart ## 🎮 Quickstart
A flow consists of __nodes__ and __edges__ (or just nodes). In Vue Flow, an application structure consists of __nodes__ and __edges__, all of which are categorised as __elements__.
Together they are called __elements__.
__Each element needs a unique id.__ __Each element requires a unique id.__
A node also needs an XY position. Nodes additionally need an __XY-position__, while edges require a __source__ and a __target__, both represented by node ids.
An edge needs a source (node id) and a target (node id).
A basic setup looks like this:
```vue ```vue
<!-- Flowchart.vue --> <!-- Flowchart.vue -->
<script setup> <script setup>
import { VueFlow } from '@vue-flow/core' import { VueFlow } from '@vue-flow/core'
const elements = ref([ const nodes = ref([
{ {
id: '1', id: '1',
label: 'node 1', label: 'node 1',
position: { x: 100, y: 100 }, position: {x: 100, y: 100},
}, },
{ {
id: '2', id: '2',
label: 'node 2', label: 'node 2',
position: { x: 100, y: 200 }, position: {x: 100, y: 200},
}, },
])
const edges = ref([
{ {
id: 'e1-2', id: 'e1-2',
target: '2', target: '2',
@@ -102,11 +104,10 @@ const elements = ref([
</script> </script>
<template> <template>
<VueFlow v-model="elements"></VueFlow> <VueFlow :nodes="nodes" :edges="edges"></VueFlow>
</template> </template>
``` ```
⚠️ __Make sure to import the necessary styles:__ ⚠️ __Make sure to import the necessary styles:__
```css ```css
@@ -117,6 +118,8 @@ const elements = ref([
@import "@vue-flow/core/dist/theme-default.css"; @import "@vue-flow/core/dist/theme-default.css";
``` ```
Do __not__ scope these styles with `scoped` in your component.
### 🪴 Vue 2 ### 🪴 Vue 2
**_This library doesn't work with Vue 2._** **_This library doesn't work with Vue 2._**
@@ -128,12 +131,11 @@ there is no support for Vue 2, nor will there be any support in the future, sorr
### Prerequisites ### Prerequisites
- [Node.js v14+](https://nodejs.org/) - [Node.js v18+](https://nodejs.org/)
- [PnPm](https://pnpm.io/) - [pnpm](https://pnpm.io/)
```bash ```bash
# skip if you already have pnpm installed # install pnpm if you haven't already
$ npm i -g pnpm $ npm i -g pnpm
# start examples # start examples
@@ -166,9 +168,9 @@ or share your work that you have built with Vue Flow.
This project is built with This project is built with
- [React Flow](https://reactflow.dev/) - [React Flow](https://reactflow.dev/)
- Vue flow is heavily based on [webkids'](https://webkid.io/) [react flow](https://reactflow.dev/). I wholeheartedly thank - Vue flow is heavily based on [webkids'](https://webkid.io/) [ReactFlow](https://reactflow.dev/). I wholeheartedly
them for their amazing work! Without them Vue Flow would not exist. thank them for their amazing work! Without them VueFlow would not exist.
Please consider [donating](https://github.com/sponsors/wbkd) to them. Please consider [donating](https://github.com/sponsors/wbkd) or subscribing to [ReactFlow Pro](https://reactflow.dev/pro).
- [D3.js](https://d3js.org/) - [D3.js](https://d3js.org/)
- D3 makes all the zoom and pan actions in Vue Flow possible. - D3 makes all the zoom and pan actions in Vue Flow possible.