RuleGo-Editor RuleGo-Editor
🏠首页
🧭使用
  • 简介
  • 安装
  • 配置
  • 组件
  • 架构设计
  • 国际化
  • 事件系统
  • 调试功能
  • AI功能
  • 自定义节点
  • 分组节点
  • RuleGo-Editor (opens new window)
  • RuleGo-Server (opens new window)
  • 后端API文档 (opens new window)
RuleGo (opens new window)
  • English
  • 简体中文
🏠首页
🧭使用
  • 简介
  • 安装
  • 配置
  • 组件
  • 架构设计
  • 国际化
  • 事件系统
  • 调试功能
  • AI功能
  • 自定义节点
  • 分组节点
  • RuleGo-Editor (opens new window)
  • RuleGo-Server (opens new window)
  • 后端API文档 (opens new window)
RuleGo (opens new window)
  • English
  • 简体中文
  • 简介
  • 安装
    • 环境支持
    • 作为 npm 库集成(推荐)
      • 1. 安装 editor
      • 2. 安装 peerDependencies
      • 3. 在 Vue 应用中使用
    • 作为独立应用(二次开发 / 部署)
      • 构建
      • 部署到 RuleGo-Server
      • 集成注意事项
  • 配置
  • 节点组件
  • 架构设计
  • 国际化
  • 事件系统
  • 调试功能
  • AI 功能
  • 自定义节点开发
  • 分组节点
目录

安装

RuleGo-Editor 有两种使用方式:作为 npm 库集成到你的 Vue 项目,或作为独立应用二次开发/部署。两者来自同一份源码。

# 环境支持

由于 Vue 3 不再支持 IE11,RuleGo-Editor 也不再支持 IE 浏览器。

Edge ≥ 79 Firefox ≥ 78 Chrome ≥ 64 Safari ≥ 12

Node.js ≥ 18。


# 作为 npm 库集成(推荐)

# 1. 安装 editor

npm i @rulego/editor
1

RuleGo-Editor 是商业授权项目,源码随授权交付。若你拿到的是源码包或私有 registry,按对应方式安装(如 npm i @rulego/editor --registry=<你的私有源>,或 npm i ./rulego-editor-x.y.z.tgz)。库产物在 dist/(rulego-editor.es.js + style.css),类型声明在 src/index.d.ts 与 src/workspace-types.d.ts。

# 2. 安装 peerDependencies

editor 把以下包作为 peerDependencies,宿主必须自行安装(避免重复打包、保证宿主与 editor 共用同一份 Vue/Element Plus 实例):

npm i vue@^3.5.0 element-plus@^2.10.0 @element-plus/icons-vue@^2.3.1 \
      @logicflow/core@^2.1.1 @logicflow/extension@^2.1.2
1
2
peerDependency 版本 说明
vue ^3.5.0 框架
element-plus ^2.10.0 UI 组件库
@element-plus/icons-vue ^2.3.1 Element Plus 图标
@logicflow/core ^2.1.1 画布引擎
@logicflow/extension ^2.1.2 LogicFlow 扩展(DndPanel/Snapshot/MiniMap 等)

# 3. 在 Vue 应用中使用

import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import App from './App.vue'

const app = createApp(App)
app.use(ElementPlus)
app.mount('#app')
1
2
3
4
5
6
7
8
<!-- App.vue -->
<template>
  <RuleGoWorkspace :options="{ mode: 'app', url: 'http://127.0.0.1:9090' }" />
</template>

<script setup>
import { RuleGoWorkspace } from '@rulego/editor'
import '@rulego/editor/style.css'   // 必须引入样式
</script>
1
2
3
4
5
6
7
8
9

Element Plus 需在宿主 app.use(ElementPlus) 注册。集成形态与配置详见 配置。


# 作为独立应用(二次开发 / 部署)

获取源码后,在项目目录执行:

安装依赖:

npm install
1

本地开发:

npm run dev
1

# 构建

editor 提供多个构建脚本,按用途选择:

脚本 产物 用途
npm run build SPA 应用(base: '/') 独立部署到根路径
npm run build:editor SPA 应用(base: '/editor/') 部署到 rulego-server 的 /editor/ 子路径
npm run build:lib ESM 库包(dist/rulego-editor.es.js + style.css) 打包成 @rulego/editor 库供宿主集成
npm run build          # 或 build:editor / build:lib
1

# 部署到 RuleGo-Server

build / build:editor 的产物默认输出到 dist/ 目录。将 dist/ 目录下的所有文件复制到 RuleGo-Server 的 editor/ 目录即可:

your-app/
├── server          # 服务端二进制
├── config.conf     # 配置文件
└── editor/         # 构建产物(原 dist/ 内容)
    ├── index.html
    ├── config/
    └── assets/
1
2
3
4
5
6
7

确保 config.conf 中 resource_mapping 配置正确:

resource_mapping = /editor/*filepath=./editor,/images/*filepath=./editor/images
1

启动 server 后访问 http://localhost:9090/ 即可使用编辑器。

# 集成注意事项

如果编辑器需要集成到 RuleGo-Server,确保用 npm run build:editor 构建(或在 vite.config.js (opens new window) 中把 base 配置为 /editor/):

export default defineConfig({
  base: '/editor/',
  // ...
})
1
2
3
4

如果是独立部署或嵌入到其他系统,根据实际路径修改 base 配置。

editor 产物已通过 go:embed 打入 server 二进制时,http://server:9090/ 直接访问即可,无需手动部署 editor/ 目录。

上次更新: 2026/08/12, 06:37:08
简介
配置

← 简介 配置→

Theme by Vdoing | Copyright © 2023-2026 RuleGo Team | Apache 2.0 License

  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式