官网

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. Go组件库总结之无等待锁

    本篇文章我们用Go封装一个无等待锁库.文章参考自:https://github.com/brewlin/net-protocol 1.锁的封装 type Mutex struct { v int32 ...

  2. 搭建CentOS 7

    首先,操作系统要部署在哪一个盘符下就在哪一个盘符下创建一个空文件夹,用来存放实验环境.这里的实验环境的文件夹可以命名为CentOS 7 x64. VMware中,"文件"--&qu ...

  3. kali安装CloudKeyKiller-一款阿里云AK泄露工具

    工具下载地址:https://github.com/UzJu/CloudKeyKiller 问题描述:ModuleNotFoundError: No module named 'aliyunsdkec ...

  4. CentOS7 设置防火墙、开放指定端口操作

    1, 查看防火墙状态: firewall-cmd --state systemctl status firewalld.service 2, 开启防火墙: systemctl start firewa ...

  5. 解决手机点击包含a、button标签时出现背景色问题

    a,button { display: inline-block; width: 100%; -webkit-tap-highlight-color:rgba(0,0,0,0);/*添加此样式即可去除 ...

  6. 国产DP4398 兼容替代CS4398 24Bit 192KHz数模转换芯片

    CS4398是一款24Bit/192K Hz规格的解码芯片,它具有120分贝以上的讯噪比和动态范围,采用一个高级专用多位Delta-Sigma调制器,并整合了失配噪声整形技术.今天来讲讲它的国产替代型 ...

  7. TIDB-DM数据迁移第一部(安装部署)

    官方连接: https://docs.pingcap.com/zh/tidb/stable/dm-overview 架构: 1.安装DM download https://tiup-mirrors.p ...

  8. Beaver解析代码反向生成语法文件

    背景 Beaver是一款LALR的语法生成工具,现在有一个反编译项目的需求,需要将Beaver语法文件编译后的代码反向生成语法文件的需求,不去评论需求多么傻逼,直接干 设计 flowchart 语法文 ...

  9. unity Android 可后台替换图片

    using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; usin ...

  10. llinux day02 基础操作 帮助 文件管理 马

    免密码登录(只是为了方便教学,免了图形界面的密码) 1,Linux免密自动以root身份登录图形化界面,修改etc/gdm/custom.conf 在deamon下面添加两行,注意区分大小写 [dae ...