官网

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. vue3 门户网站搭建6-wangeditor

    门户网站的新闻.公告等文章,内容可配置,故引入 wagneditor 1.安装: npm i wangeditor 2.方便调用,抽成组件: <template> <div ref= ...

  2. 通过一个简单的实例来展示 Java 编程,创建文件 HelloWorld.java

    public class HelloWorld { public static void main(String[] args) { System.out.println("Hello Wo ...

  3. oracle job的使用

    select job, next_date, next_sec, failures, broken from user_jobs; create or replace sequence END_RES ...

  4. Neural Network模型复杂度之Residual Block - Python实现

    背景介绍 Neural Network之模型复杂度主要取决于优化参数个数与参数变化范围. 优化参数个数可手动调节, 参数变化范围可通过正则化技术加以限制. 本文从优化参数个数出发, 以Residual ...

  5. 【服务器数据恢复】热备盘同步失败导致数据丢失的raid5数据恢复案例

    服务器数据恢复环境:华为s系列服务器:24块硬盘组成一组raid5磁盘阵列,其中包含1块热备盘. 服务器故障&检测:服务器工作状态下raid5中有一块硬盘离线,热备盘激活替换离线硬盘并开始进行 ...

  6. my tools in windows

    Q-Dir the Quad Explorerhttp://www.q-dir.com/ NetSpeed Monitor - Network Speed Monitor for Windows 10 ...

  7. OpenLayer——模拟运动轨迹

    模拟在人地图上移动,动态绘制行动轨迹的功能,附带一个跟随的气泡弹窗. <!DOCTYPE html> <html lang="en"> <head&g ...

  8. Unity2018 用vs2017打开脚本时,不兼容不能加载工程

    修改    <TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion> 为 <TargetFrameworkVersi ...

  9. select multiple 浏览器兼容

    select multiple 时一般是设置 height <select multiple="multiple" style="height:87px;" ...

  10. chrome浏览器通知与语音播放

    HTML5 Web Notification 语法 https://developer.mozilla.org/zh-CN/docs/Web/API/notification 如果浏览器支持Web N ...