首页 > 其他分享 >logic-flow自定义节点

logic-flow自定义节点

时间:2023-02-07 10:24:52浏览次数:44  
标签:lf 自定义 flow logicflow CustomCircleNode logic import 节点

目前基于需要选择任一一种基本节点类型(如rect、circle、polygon等)来继承

新建节点文件(例:CustomCircle.js)

// CustomCircle.js
import { CircleNode, CircleNodeModel } from "@logicflow/core";
// 继承基础节点
class customCircleModel extends CircleNodeModel {
    // 定义此注册类型节点的样式(获取样式相关的方法)
}
class customCircleView extends CircleNode {
    // 定义此注册类型节点svg dom(getShape定义更复杂的节点外观)
}
export default {
    type: "CustomCircleNode",
    view: customCircleView,
    model: customCircleModel
};

引入注册+使用

<template>
    <el-container>
        <div class="container" ref="container"></div>
    </el-container>
</template>

<script>
import LogicFlow from '@logicflow/core';
import '@logicflow/core/dist/style/index.css';
// 1.引入自定义节点
import CustomCircleNode from '../components/CustomCircle.js';

export default {
    data() {
        return {
            nodes: [
                {
                    id: '1',
                    // 3.使用自定义节点
                    type: 'CustomCircleNode',
                    x: 100,
                    y: 100,
                }
            ],
        };
    },
    mounted() {
        this.lf = new LogicFlow({
            container: this.$refs.container,
            grid: true,
        });
        // 2.注册自定义节点
        this.lf.register(CustomCircleNode);
        this.lf.render({
            nodes: this.nodes,
            edges: this.edges,
        });
    },
};
</script>

<style>
.container {
    width: 1000px;
    height: 500px;
}
</style>

 

标签:lf,自定义,flow,logicflow,CustomCircleNode,logic,import,节点
From: https://www.cnblogs.com/nicoz/p/17097438.html

相关文章

  • CodeForces 1423G Growing flowers
    洛谷传送门CF传送门先离散化颜色。考虑对每种颜色单独求出答案。对于颜色\(x\),可以用总方案数\(n-k+1\)减去一个\(x\)都不包含的区间数量。对于这个,假设相邻两个颜......
  • avalonia实现自定义小弹窗
    对于使用avalonia的时候某些功能需要到一些提示,比如异常或者成功都需要对用户进行提示,所以需要单独实现弹窗功能,并且可以自定义内部组件,这一期将手动实现一个简单的小弹窗,......
  • SpringBoot怎么自定义一个Starter
    SpringBoot怎么自定义一个Starterstarter是什么spring-boot-starter是spring-boot的一个非常重要组成部分。spring-boot-starter可以理解为一个可拔插式的组件。它可以让......
  • Odoo 自定义form表单按钮点击事件处理程序
    实践环境Odoo14.0-20221212(CommunityEdition)代码实现方案1通过研究发现,点击odooform表单按钮时,会调用odoo14\odoo\addons\web\static\src\js\views\form\form_co......
  • webrtc 自定义对接摄像机视频流
    ​​https://blog.csdn.net/u013113491/article/details/80285181​​编码器伪装法​​https://blog.csdn.net/foruok/article/details/70237019​​众所周知浏览器不支持......
  • SpringBoot中自定义消息转化器
    场景1.SpringBoot自动配置了消息转化器。2.自定义消息转化器,只需要在类中添加消息转化器的@Bean,就会被SpringBoot自动加入到容器中。实现新建Controllerpackagecom.exampl......
  • 详解Spring AOP自定义可重复注解没有生效问题
    目录1.问题背景2.不啰嗦,上代码3.问题排查3.1是不是切点写得有问题,于是换成如下形式:3.2是不是使用的地方不是代理对象4.问题原因 1.问题背景工作中遇......
  • 自定义鼠标右键菜单
     鼠标右键弹出框<template><divclass="conversation-item-menubox-shadow1"><spanclass="menu-itemoperation-text"@click.stop="openNewPage">打......
  • tensorflow中slim详解
    1.变量的定义 from__future__importabsolute_importfrom__future__importdivisionfrom__future__importprint_functionimporttensorflowastfslim=tf.contrib......
  • TensorFlow图像处理函数
    1.读取图片importmatplotlib.pyplotaspltimporttensorflowastfimportnumpyasnpimage_raw_data=tf.gfile.FastGFile('./datasets/cat.png','rb').read()withtf.......