官网

Vue Flow 官网

Vue Flow GitHub

安装

npm i --save @vue-flow/core

yarn add @vue-flow/core

pnpm i @vue-flow/core

使用

<template>
<VueFlow v-model="elements" />
</template> <script setup>
import { VueFlow } from '@vue-flow/core' const elements = ref([
// Nodes
// An input node, specified by using `type: 'input'`
{ id: '1', type: 'input', label: 'Node 1', position: { x: 250, y: 5 } }, // Default nodes, you can omit `type: 'default'`
{ id: '2', label: 'Node 2', position: { x: 100, y: 100 }, },
{ id: '3', label: 'Node 3', position: { x: 400, y: 100 } }, // An output node, specified by using `type: 'output'`
{ id: '4', type: 'output', label: 'Node 4', position: { x: 400, y: 200 } }, // Edges
// Most basic edge, only consists of an id, source-id and target-id
{ id: 'e1-3', source: '1', target: '3' }, // An animated edge
{ id: 'e1-2', source: '1', target: '2', animated: true },
])
</script> <style>
/* these are necessary styles for vue flow */
@import "@vue-flow/core/dist/style.css"; /* this contains the default theme, these are optional styles */
@import "@vue-flow/core/dist/theme-default.css";
</style>

常用功能:

  1. 画布居中
import { VueFlow, useVueFlow } from "@vue-flow/core";
const { onPaneReady } = useVueFlow();
const state = reactive({
instance: null,
});
onPaneReady((instance) => {
instance.fitView();
// 将对象缓存
state.instance = instance;
}); // 设置缩放级别
state.instance.fitView({ offset: { y: 50 } });
state.instance.zoomTo(1);
  1. 点击事件
  <VueFlow
v-model="flowElement"
:style="{ background: 'transparent' }"
:default-zoom="1"
fit-view-on-init
@nodeClick="nodeClickHandler"
/>
const nodeClickHandler = (props) => {
const node = props.node;
console.log(node.id);
};

Vue3 流程图组件库 Vue Flow 简单使用的更多相关文章

  1. vue统计组件库和ui框架

    UI组件 element ★13489 - 饿了么出品的Vue2的web UI工具套件 Vux ★8133 - 基于Vue和WeUI的组件库 iview ★6634 - 基于 Vuejs 的开源 UI ...

  2. Vue3 企业级优雅实战 - 组件库框架 - 1 搭建 pnpm monorepo

    前两篇文章分享了基于 vite3 vue3 的组件库基础工程 vue3-component-library-archetype 和用于快速创建该工程的工具 yyg-cli,但在中大型的企业级项目中,通 ...

  3. Vitepress搭建组件库文档(上)—— 基本配置

    在 vite 出现以前,vuepress 是搭建组件库文档不错的工具,支持以 Markdown 方式编写文档.伴随着 vite 的发展,vitepress 已经到了 1.0.0-alpha.22 版本 ...

  4. Vite+TS带你搭建一个属于自己的Vue3组件库

    theme: nico 前言 随着前端技术的发展,业界涌现出了许多的UI组件库.例如我们熟知的ElementUI,Vant,AntDesign等等.但是作为一个前端开发者,你知道一个UI组件库是如何被 ...

  5. 使用VitePress搭建及部署vue组件库文档

    每个组件库都有它们自己的文档.所以当我们开发完成我们自己的组件库必须也需要一个组件库文档.如果你还不了解如何搭建自己的组件库可以看这里->从零搭建Vue3组件库.看完这篇文章你就会发现原来搭建和 ...

  6. 从0搭建Vue3组件库:button组件

    button组件几乎是每个组件库都有的:其实实现一个button组件是很简单的.本篇文章将带你一步一步的实现一个button组件.如果你想了解完整的组件库搭建,你可以先看使用Vite和TypeScri ...

  7. 从0搭建vue3组件库:Shake抖动组件

    先看下效果 其实就是个抖动效果组件,实现起来也非常简单.之所以做这样一个组件是为了后面写Form表单的时候会用到它做一个规则校验,比如下面一个简单的登录页面,当点击登录会提示用户哪个信息没输入,当然这 ...

  8. 从0搭建vue3组件库: 如何完整搭建一个前端脚手架?

    相信大家在前端开发中都使用过很多前端脚手架,如vue-cli,create-vite,create-vue等:本篇文章将会为大家详细介绍这些前端脚手架是如何实现的,并且从零实现一个create-kit ...

  9. 开箱即用 yyg-cli(脚手架工具):快速创建 vue3 组件库和vue3 全家桶项目

    1 yyg-cli 是什么 yyg-cli 是优雅哥开发的快速创建 vue3 项目的脚手架.在 npm 上发布了两个月,11月1日进行了大升级,发布 1.1.0 版本:支持创建 vue3 全家桶项目和 ...

  10. 从0搭建vue3组件库: Input组件

    本篇文章将为我们的组件库添加一个新成员:Input组件.其中Input组件要实现的功能有: 基础用法 禁用状态 尺寸大小 输入长度 可清空 密码框 带Icon的输入框 文本域 自适应文本高度的文本域 ...

随机推荐

  1. (1019) rapidsvn 安装

    https://blog.csdn.net/mzpmzk/article/details/106332039

  2. 活动 | Cloud Ace 受邀参加中国智造出海数字科技峰会

    [Cloud Ace 是谷歌云全球战略合作伙伴,拥有 200 多名工程师,也是谷歌最高级别合作伙伴,多次获得 Google Cloud 合作伙伴奖. 作为谷歌托管服务商,我们提供谷歌云.谷歌地图.谷歌 ...

  3. ts(typescript)讲解for , for...in..., for...of..., while, every, some, map, filter

    for  一般用于已知循环次数 var num:number = 5; var i:number; var factorial = 1; for(i = num;i>=1;i--) { fact ...

  4. 微信小程序之配置业务域名踩过的坑

    1.在配置业务域名弹窗中保存按钮一直加载状态,无法保存则刷新当前界面后重新扫码打开该弹窗.2.检验文件一定要放在目标服务器域名下前端文件夹中,否则(放在后台代码文件夹中)访问不到地址.

  5. unity 2D 物体跟随鼠标旋转 移动

    using System.Collections; using System.Collections.Generic; using UnityEngine; public class FollowMo ...

  6. Web安全测试之XSS【转】

    作者: 小坦克  来源: 博客园   原文链接:http://www.cnblogs.com/TankXiao/archive/2012/03/21/2337194.html XSS 全称(Cross ...

  7. mybatis-关联查询2-多对一关联查询

    或者多表单独查询方式

  8. shopt 内置命令启用shell选项 (extglob)

    使用shopt 内置命令启用shell选项 (extglob) 则会识别几个扩展模式匹配运算符 模式列表是由 | 分割 查看shell选项 extglob shopt |grep extglob 启动 ...

  9. 更改材质uv

  10. idea安装破解

    转 一般都会去官网下载,官网地址IntelliJ IDEA,官网上对于不同的操作系统(windows,macOS,Linux)都有两个版本可供下载 3|0安装 确认已经安装好了 JDK ,每个IDEA ...