ruoyi-vue-pro 开发指南 ruoyi-vue-pro 开发指南
  • 萌新必读
  • 后端手册
  • 中间件手册
  • 工作流手册
  • 大屏手册
  • 支付手册
  • 会员手册
  • 商城手册
  • ERP 手册
  • CRM 手册
  • AI 大模型手册
  • IoT 物联网手册
  • 公众号手册
  • 系统手册
  • 运维手册
  • 前端手册 Vue 2.x
  • 前端手册 Vue 3.x
  • 工作流手册
  • 大屏手册
  • 支付手册
  • 会员手册
  • 商城手册
  • ERP 手册
  • CRM 手册
  • AI 大模型手册
  • IoT 物联网手册
  • 公众号手册
  • 系统手册
视频教程
  • Vue3 + element-plus (opens new window)
  • Vue3 + vben(ant-design-vue) (opens new window)
  • Vue2 + element-ui (opens new window)
微服务版 (opens new window)
作者博客 (opens new window)
GitHub (opens new window)
  • 萌新必读
  • 后端手册
  • 中间件手册
  • 工作流手册
  • 大屏手册
  • 支付手册
  • 会员手册
  • 商城手册
  • ERP 手册
  • CRM 手册
  • AI 大模型手册
  • IoT 物联网手册
  • 公众号手册
  • 系统手册
  • 运维手册
  • 前端手册 Vue 2.x
  • 前端手册 Vue 3.x
  • 工作流手册
  • 大屏手册
  • 支付手册
  • 会员手册
  • 商城手册
  • ERP 手册
  • CRM 手册
  • AI 大模型手册
  • IoT 物联网手册
  • 公众号手册
  • 系统手册
视频教程
  • Vue3 + element-plus (opens new window)
  • Vue3 + vben(ant-design-vue) (opens new window)
  • Vue2 + element-ui (opens new window)
微服务版 (opens new window)
作者博客 (opens new window)
GitHub (opens new window)
  • 萌新必读

    • 简介
    • 交流群
    • 视频教程
    • 功能列表
    • 快速启动(后端项目)
    • 快速启动(前端项目)
    • 接口文档
    • 技术选型
    • 项目结构
    • 代码热加载
    • 一键改包
    • 迁移模块(适合新项目)
    • 删除功能(以租户为例)
    • 表结构变更(版本升级)
    • 国产信创数据库(DM 达梦、大金、OpenGauss)
    • 如何去除 Redis 缓存
    • 内网穿透
    • 面试题、简历模版、简历优化
    • 项目外包
  • 后端手册

    • 新建模块
    • 代码生成【单表】(新增功能)
    • 代码生成【主子表】
    • 代码生成(树表)
    • 功能权限
    • 数据权限
    • 用户体系
    • 三方登录
    • OAuth 2.0(SSO 单点登录)
    • SaaS 多租户【字段隔离】
    • SaaS 多租户【数据库隔离】
    • WebSocket 实时通信
    • 异常处理(错误码)
    • 参数校验、时间传参
    • 分页实现
    • VO 对象转换、数据翻译
    • 文件存储(上传下载)
    • Excel 导入导出
    • 操作日志、访问日志、异常日志
    • MyBatis 数据库
    • MyBatis 联表&分页查询
    • 多数据源(读写分离)、事务
    • Redis 缓存
    • 本地缓存
    • 异步任务
    • 分布式锁
    • 幂等性(防重复提交)
    • 请求限流(RateLimiter)
    • HTTP 接口签名(防篡改)
    • 单元测试
    • 验证码
    • 工具类 Util
    • 配置管理
    • 数据库文档
  • 中间件手册

    • 定时任务
    • 消息队列(内存)
    • 消息队列(Redis)
    • 消息队列(RocketMQ)
    • 消息队列(RabbitMQ)
    • 消息队列(Kafka)
    • 限流熔断
  • 工作流手册

    • 工作流演示
    • 功能开启
    • 工作流(达梦适配)
    • 审批接入(流程表单)
    • 审批接入(业务表单)
    • 流程设计器(BPMN)
    • 流程设计器(钉钉、飞书)
    • 选择审批人、发起人自选
    • 会签、或签、依次审批
    • 流程发起、取消、重新发起
    • 审批通过、不通过、驳回
    • 审批加签、减签
    • 审批转办、委派、抄送
    • 执行监听器、任务监听器
    • 流程表达式
    • 流程审批通知
  • 大屏手册

    • 报表设计器
    • 大屏设计器
  • 支付手册

    • 功能开启
    • 支付宝支付接入
    • 微信公众号支付接入
    • 微信小程序支付接入
    • 支付宝、微信退款接入
    • 支付宝转账接入
    • 微信转账接入
    • 钱包充值、支付、退款
    • 模拟支付、退款
  • 会员手册

    • 功能开启
    • 微信公众号登录
    • 微信小程序登录
    • 微信小程序订阅消息
    • 微信小程序码
    • 会员用户、标签、分组
    • 会员等级、积分、签到
  • 商城手册

    • 商城演示
    • 功能开启
    • 商城装修
    • 在线客服
    • 【商品】商品分类
    • 【商品】商品属性
    • 【商品】商品 SPU 与 SKU
    • 【商品】商品评价
    • 【交易】购物车
    • 【交易】交易订单
    • 【交易】售后退款
    • 【交易】快递发货
    • 【交易】门店自提
    • 【交易】分销返佣
    • 【营销】优惠劵
    • 【营销】积分商城
    • 【营销】拼团活动
    • 【营销】秒杀活动
    • 【营销】砍价活动
    • 【营销】满减送活动
    • 【营销】限时折扣
    • 【营销】内容管理
    • 【统计】会员、商品、交易统计
  • ERP手册

    • ERP 演示
    • 功能开启
    • 【产品】产品信息、分类、单位
    • 【库存】产品库存、库存明细
    • 【库存】其它入库、其它出库
    • 【库存】库存调拨、库存盘点
    • 【采购】采购订单、入库、退货
    • 【销售】销售订单、出库、退货
    • 【财务】采购付款、销售收款
  • CRM手册

    • CRM 演示
    • 功能开启
    • 【线索】线索管理
    • 【客户】客户管理、公海客户
    • 【商机】商机管理、商机状态
    • 【合同】合同管理、合同提醒
    • 【回款】回款管理、回款计划
    • 【产品】产品管理、产品分类
    • 【通用】数据权限
    • 【通用】跟进记录、待办事项
  • AI大模型手册

    • AI 大模型演示
    • 功能开启
    • AI 聊天对话
    • AI 绘画创作
    • AI 知识库
    • AI 音乐创作
    • AI 写作助手
    • AI 思维导图
    • AI 工具(function calling)
    • AI 工作流
    • Dify 工作流
    • FastGPT 工作流
    • Coze 智能体
    • 【模型接入】OpenAI
    • 【模型接入】通义千问
    • 【模型接入】DeepSeek
    • 【模型接入】字节豆包
    • 【模型接入】腾讯混元
    • 【模型接入】硅基流动
    • 【模型接入】MiniMax
    • 【模型接入】月之暗灭
    • 【模型接入】百川智能
    • 【模型接入】文心一言
    • 【模型接入】LLAMA
    • 【模型接入】智谱 GLM
    • 【模型接入】讯飞星火
    • 【模型接入】微软 OpenAI
    • 【模型接入】谷歌 Gemini
    • 【模型接入】Stable Diffusion
    • 【模型接入】Midjourney
    • 【模型接入】Suno
  • IoT物联网手册

    • 功能开启
  • 公众号手册

    • 功能开启
    • 公众号接入
    • 公众号粉丝
    • 公众号标签
    • 公众号消息
    • 自动回复
    • 公众号菜单
    • 公众号素材
    • 公众号图文
    • 公众号统计
  • 系统手册

    • 短信配置
    • 邮件配置
    • 站内信配置
    • 数据脱敏、字段权限
    • 敏感词
    • 地区 & IP 库
  • 运维手册

    • 开发环境
    • Linux 部署
    • Docker 部署
    • Jenkins 部署
    • 宝塔部署
    • HTTPS 证书
    • 服务监控
  • 前端手册 Vue 3.x

    • 开发规范
    • 菜单路由
    • Icon 图标
    • 字典数据
    • 系统组件
      • 1. 常用组件
        • 1.1 Editor 富文本组件
        • 1.2 Dialog 弹窗组件
        • 1.3 ContentWrap 包裹组件
        • 1.4 Pagination 分页组件
        • 1.5 UploadFile 上传文件组件
        • 1.6 UploadImg 上传图片组件
      • 2. 不常用组件
        • 2.1 EChart 图表组件
        • 2.2 InputPassword 密码输入框
        • 2.3 ContentDetailWrap 详情包裹组件
        • 2.4 ImageViewer 图片预览组件
        • 2.5 Qrcode 二维码组件
        • 2.6 Highlight 高亮组件
        • 2.7 Error 缺省组件
        • 2.8 Sticky 黏性组件
        • 2.9 CountTo 数字动画组件
        • 2.10 useWatermark 水印组件
        • 2.11 form-create 动态表单生成器
        • 2.12 bpmn-js 工作流组件
      • 3. 组件注册
        • 3.1 按需引入
        • 3.2 全局注册
    • 通用方法
    • 配置读取
    • CRUD 组件
    • 国际化
    • IDE 调试
    • 代码格式化
  • 前端手册 Vue 2.x

    • 开发规范
    • 菜单路由
    • Icon 图标
    • 字典数据
    • 系统组件
    • 通用方法
    • 配置读取
  • 更新日志

    • 【v2.5.0】开发中...
    • 【v2.4.2】2025-04-12
    • 【v2.4.1】2025-02-09
    • 【v2.4.0】2024-12-31
    • 【v2.3.0】2024-10-07
    • 【v2.2.0】2024-08-02
    • 【v2.1.0】2024-05-05
    • 【v2.0.1】2024-03-01
    • 【v2.0.0】2024-01-26
  • 开发指南
  • 前端手册 Vue 3.x
芋道源码
2022-12-31
目录

系统组件

# 1. 常用组件

# 1.1 Editor 富文本组件

基于 wangEditor (opens new window) 封装

  • Editor 组件:位于 src/components/Editor (opens new window) 内
  • 详细文档:vue-element-plus-admin-doc/components/editor.html (opens new window)
  • 实战案例:src/views/system/notice/form.vue (opens new window)

Editor 富文本组件

# 1.2 Dialog 弹窗组件

对 Element Plus 的 Dialog 组件进行封装,支持最大化、最大高度等特性

  • Dialog 组件:位于 src/components/Dialog (opens new window) 内
  • 详细文档:vue-element-plus-admin-doc/components/dialog.html (opens new window)
  • 实战案例:src/views/system/dept/DeptForm.vue (opens new window)

Dialog 弹窗组件

# 1.3 ContentWrap 包裹组件

对 Element Plus 的 ElCard 组件进行封装,自带标题、边距

  • ContentWrap 组件:位于 src/components/ContentWrap (opens new window) 内
  • 实战案例:src/views/system/post/index.vue (opens new window)

ContentWrap 包裹组件

# 1.4 Pagination 分页组件

对 Element Plus 的 Pagination (opens new window) 组件进行封装

  • Pagination 组件:位于 src/components/Pagination (opens new window) 内
  • 实战案例:src/views/system/post/index.vue (opens new window)

Pagination 分页组件

# 1.5 UploadFile 上传文件组件

对 Element Plus 的 Upload (opens new window) 组件进行封装,上传文件到文件服务

  • UploadFile 组件:位于 src/components/UploadFile/src/UploadFile.vue (opens new window) 内
  • 实战案例:暂无

# 1.6 UploadImg 上传图片组件

对 Element Plus 的 Upload (opens new window) 组件进行封装,上传图片到文件服务

  • UploadImg 组件:位于 src/components/UploadFile/src/UploadImg.vue (opens new window) 内
  • 实战案例:src/views/system/oauth2/client/ClientForm.vue (opens new window)

UploadImg 上传图片组件

# 2. 不常用组件

# 2.1 EChart 图表组件

基于 Apache ECharts (opens new window) 封装,自适应窗口大小

  • EChart 组件:位于 src/components/EChart (opens new window) 内
  • 详细文档:vue-element-plus-admin-doc/components/echart.html (opens new window)
  • 实战案例:src/views/mp/statistics/index.vue (opens new window)

EChart 图表组件

# 2.2 InputPassword 密码输入框

对 Element Plus 的 Input 组件进行封装

  • InputPassword 组件:位于 src/components/InputPassword (opens new window) 内
  • 详细文档:vue-element-plus-admin-doc/components/input-password.html (opens new window)
  • 实战案例:src/views/Profile/components/ResetPwd.vue (opens new window)

# 2.3 ContentDetailWrap 详情包裹组件

用于展示详情,自带返回按钮。

  • ContentDetailWrap 组件:位于 src/components/ContentDetailWrap (opens new window) 内
  • 详细文档:vue-element-plus-admin-doc/components/content-detail-wrap.html (opens new window)
  • 实战案例:暂无

# 2.4 ImageViewer 图片预览组件

将 Element Plus 的 ImageViewer (opens new window) 组件函数化,通过函数方便创建组件

  • ImageViewer 组件:位于 src/components/ImageViewer (opens new window) 内
  • 详细文档:vue-element-plus-admin-doc/components/image-viewer.html (opens new window)
  • 实战案例:暂无

# 2.5 Qrcode 二维码组件

基于 qrcode (opens new window) 封装

  • Qrcode 组件:位于 src/components/Qrcode (opens new window) 内
  • 详细文档:vue-element-plus-admin-doc/components/qrcode.html (opens new window)
  • 实战案例:暂无

Qrcode 二维码组件

# 2.6 Highlight 高亮组件

  • Highlight 组件:位于 src/components/Highlight (opens new window) 内
  • 详细文档:vue-element-plus-admin-doc/components/highlight.html (opens new window)
  • 实战案例:暂无

Highlight 高亮组件

# 2.6.1 Infotip 信息提示组件

基于 Highlight 组件封装

  • Infotip 组件:位于 src/components/Infotip (opens new window) 内
  • 详细文档:vue-element-plus-admin-doc/components/infotip.html (opens new window)
  • 实战案例:暂无

Infotip 信息提示组件

# 2.7 Error 缺省组件

用于各种占位图组件,如 404、403、500 等错误页面。

  • Error 组件:位于 src/components/Error (opens new window) 内
  • 详细文档:vue-element-plus-admin-doc/components/error.html (opens new window)
  • 实战案例:403.vue (opens new window)、404.vue (opens new window)、500.vue (opens new window)

# 2.8 Sticky 黏性组件

  • Sticky 组件:位于 src/components/Sticky (opens new window) 内
  • 详细文档:vue-element-plus-admin-doc/components/sticky.html (opens new window)
  • 实战案例:暂无

Sticky 信息提示组件

# 2.9 CountTo 数字动画组件

  • CountTo 组件:位于 src/components/CountTo (opens new window) 内
  • 详细文档:vue-element-plus-admin-doc/components/count-to.html (opens new window)
  • 实战案例:暂无

# 2.10 useWatermark 水印组件

为元素设置水印

  • useWatermark 组件:位于 src/hooks/web/useWatermark.ts (opens new window) 内
  • 详细文档:vue-element-plus-admin-doc/hooks/useWatermark.html (opens new window)
  • 实战案例:暂无

useWatermark 水印组件

# 2.11 form-create 动态表单生成器

详细文档:http://www.form-create.com/ (opens new window)

① 实战案例 - 表单设计:src/views/infra/build/index.vue (opens new window)

表单设计

② 实战案例 - 表单展示:src/views/bpm/processInstance/detail/index.vue (opens new window)

表单展示

# 2.12 bpmn-js 工作流组件

核心是基于 bpmn-js (opens new window) 封装

# 2.12.1 MyProcessDesigner 流程设计组件

  • MyProcessDesigner 组件:位于 src/components/bpmnProcessDesigner/package/designer/index.ts (opens new window) 内,基于 https://gitee.com/MiyueSC/bpmn-process-designer (opens new window) 项目适配
  • 实战案例:src/views/bpm/model/editor/index.vue (opens new window)

MyProcessDesigner 流程设计组件

# 2.12.2 MyProcessViewer 流程展示组件

  • MyProcessViewer 组件:位于 src/components/bpmnProcessDesigner/package/designer/index2.ts (opens new window) 内
  • 实战案例:src/views/bpm/processInstance/detail/ProcessInstanceBpmnViewer.vue (opens new window)

MyProcessViewer 流程展示组件

# 3. 组件注册

友情提示:

该小节,基于 《vue element plus admin —— 组件注册 》 (opens new window) 的内容修改。

组件注册可以分成两种类型:按需引入、全局注册。

# 3.1 按需引入

项目目前的组件注册机制是按需注册,是在需要用到的页面才引入。

<script setup lang="ts">
import { ElBacktop } from 'element-plus'
import { useDesign } from '@/hooks/web/useDesign'

const { getPrefixCls, variables } = useDesign()

const prefixCls = getPrefixCls('backtop')
</script>

<template>
  <ElBacktop
    :class="`${prefixCls}-backtop`"
    :target="`.${variables.namespace}-layout-content-scrollbar .${variables.elNamespace}-scrollbar__wrap`"
  />
</template>

注意:tsx 文件内不能使用全局注册组件,需要手动引入组件使用。

# 3.2 全局注册

如果觉得按需引入太麻烦,可以进行全局注册,在 src/components/index.ts (opens new window),添加需要注册的组件。

以 Icon 组件进行了全局注册,举个例子:

import type { App } from 'vue'
import { Icon } from './Icon'

export const setupGlobCom = (app: App<Element>): void => {
  app.component('Icon', Icon)
}

如果 Element Plus 的组件需要全局注册,在 src/plugins/elementPlus/index.ts (opens new window) 添加需要注册的组件。

以 Element Plus 中只有 ElLoading 与 ElScrollbar 进行全局注册,举个例子:

import type { App } from 'vue'

// 需要全局引入一些组件,如 ElScrollbar,不然一些下拉项样式有问题
import { ElLoading, ElScrollbar } from 'element-plus'

const plugins = [ElLoading]

const components = [ElScrollbar]

export const setupElementPlus = (app: App) => {
  plugins.forEach((plugin) => {
    app.use(plugin)
  })

  components.forEach((component) => {
    app.component(component.name, component)
  })
}
字典数据
通用方法

← 字典数据 通用方法→

Theme by Vdoing | Copyright © 2019-2025 芋道源码 | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式
×