snakerflow-designer-vue-plus
Version:
首先感谢snakerflow-designer-vue的原作者,提供了一个如此好用的工具。本人在此基础上,添加了子流程相关的节点,并将折线改为横线,横线文字说明可跟着横线的位置自动跟随移动。
28 lines (27 loc) • 914 B
JavaScript
// 导入流程设计器组件
import SnakerFlowDesigner from './SnakerFlowDesigner/src/snakerflow/index.js'
import * as Tool from './SnakerFlowDesigner/src/snakerflow/tool'
// 存储组件列表
const components = [
SnakerFlowDesigner
]
// 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
const install = function (Vue) {
// 判断是否安装
if (install.installed) return
// 遍历注册全局组件
components.map(component => Vue.component(component.name, component))
// 安装工具类
Vue.prototype.$wfTool = Tool
}
// 判断是否是直接引入文件
if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue)
}
export default {
// 导出的对象必须具有 install,才能被 Vue.use() 方法安装
install,
// 以下是具体的组件列表
SnakerFlowDesigner,
Tool
}