A visual flow editor based on vue and antv/g6
vue-visual-flow
It is based on antv/g6
the configuration of the visualization routine implemented Vue
components
Project uses rollup
packaged, are provided cjs
esm
in two modular form to introduce ways, size is only about 100K
In order to remove the business logic as much as possible, the component shares the G6 instance, as well as the current operating node and edge instance, for users to complete their own business logic externally
About G6 api: G6
antv/g6
there will be an updated version of the problem after the disappearance of custom graphics, it does not support the new antv/g6
tracking Issue: G6-Issueissue has been fixed, use
antv/[email protected]
and above
tips
and anchor configuration labelName
causes a problem can not be switched prompt information g6-issueissue has been fixed, use
antv/[email protected]
and above
$ npm install @antv/g6 --save
$ npm install vue-visual-flow --save
main.js
import VisualFlow from 'vue-visual-flow';
Vue.use(VisualFlow);
index.vue
<template>
<div id="app">
<visual-flow
:tree-list="treeList"
:tool-list="toolList"
:contextmenu-list="contextmenuList"
:graph.sync="graph"
:current-node.sync="currentNode"
:current-edge.sync="currentEdge"
@contextmenuEvent="contextmenuEvent"
/>
</div>
</template>
< script >
export default {
name : 'App' ,
data ( ) {
return {
// Tree node list on the left, compatible with 2-n depth
treeList : [
// First level category
{
label : 'First level category 1' ,
showFlag : false ,
children : [
// Secondary category
{
label : 'Secondary category 1-1' ,
showFlag : false ,
children : [
// Three-level category (node)
{
// Basic attribute
label: 'Node 1' , // Node display name
tips : 'Add some node description information here~' , // (Optional) Node floating tip
inPoints : [ // Enter anchor point array
{
dataType : 'type1' , / / Custom anchor point type, only in and out anchor points of the same type can be connected
labelName : 'Incoming anchor point type is type1' , // (optional) Anchor point prompt information
} ,
{
dataType : 'type2' ,
labelName : 'Incoming anchor point type is type2' ,
} ,
] ,
outPoints : [ // Out anchor point array
{
dataType : 'type1',
labelName : 'Anchor point type is type1' ,
} ,
] ,
// Custom attribute
itemId : 'xxx' , // Node id
} ,
] ,
} ,
] ,
} ,
] ,
// Optional canvas control
toolList : [ 'zoomIn' , 'zoomOut' , 'adjustCanvas' , ' realRatio' , 'autoFormat' , 'fullScreen' ] ,
// right-click menu configuration
contextmenuList : {
// node right-click menu
node : [
{
label : 'delete node' ,
eventName :'removeNode' , // custom event contextmenuEvent will capture this field
} ,
] ,
// side right-click menu
edge : [
{
label : 'remove edge' ,
eventName : 'removeEdge' ,
} ,
] ,
// right-click menu
canvas : [
{
label : 'Don't know what to do' ,
eventName : 'unknow' ,
} ,
] ,
} ,
// Share g6 instance
graph with components : { } , // g6 instance
currentNode : { } , // Node instance
currentEdge : { } , // Edge instance when left and right keys
} ;
} ,
methods : {
contextmenuEvent ( eventName ) {
// eventName matches the field with the same name in contextmenuList
if ( eventName === 'removeNode' ) {
this . graph . removeItem ( this . currentNode);
}
if (eventName === 'removeEdge') {
this.graph.removeItem(this.currentEdge);
}
if ( eventName === 'unknow' ) {
alert ( 'Really didn't do anything' ) ;
}
} ,
} ,
} ;
</ script >
Author: qunzi0214
Demo: https://github.com/qunzi0214/vue-visual-flow-demo
Source Code: https://github.com/qunzi0214/vue-visual-flow
In this article, we are going to list out the most popular websites using Vue JS as their frontend framework. Vue JS is one of those elite progressive JavaScript frameworks that has huge demand in the web development industry. Many popular websites are developed using Vue in their frontend development because of its imperative features.
Vue Native is a framework to build cross platform native mobile apps using JavaScript. It is a wrapper around the APIs of React Native. So, with Vue Native, you can do everything that you can do with React Native. With Vue Native, you get
In this article, you’ll learn how to build a Vue custom select component that can be easily be styled using your own CSS. In fact, it’s the same component that we use in production on Qvault, and you can see it in action on the playground.
There are plenty of libraries out there that will have you up and running with a good tooltip solution in minutes. However, if you are like me, you are sick and tired of giant dependency trees that have the distinct possibility of breaking at any time.
Vue-ShortKey - The ultimate shortcut plugin to improve the UX .Vue-ShortKey - plugin for VueJS 2.x accepts shortcuts globaly and in a single listener.