VueCMF
首页
教程
  • 前端
  • 后端(Go版)
  • 后端(PHP版)
后端API
组件
演示
讨论
GitHub
旧版
首页
教程
  • 前端
  • 后端(Go版)
  • 后端(PHP版)
后端API
组件
演示
讨论
GitHub
旧版
  • 组件

vue3-vuecmf-table

介绍

vue3-vuecmf-table是一款基于vue3、Element Plus和TypeScript的多功能列表组件,支持树形列表数据,内置搜索、筛选、分页、行展开、详情、编辑、导出和导入EXCEL等功能。

DownloadsVersionLicense

项目托管地址:

  1. Github: https://github.com/vuecmf/vue3-vuecmf-table
  2. Gitee: https://gitee.com/emei/vue3-vuecmf-table

演示

安装

使用

导入组件

在项目的main.ts 文件中导入组件,如下

模板中使用

若你只需要列表展示、搜索及导出数据,无需表单及增删等按钮,可以使用下面“基础功能”方式使用。

后端API示例

属性

属性必须说明类型可选值默认值
server是加载列表数据的后端API链接,必须string-空
save_server否保存单条数据的后端API链接,若add_btn_visible属性为true或edit_btn_visible属性返回true时,此属性必须string-空
import_server否导入数据的后端API链接,若列表需要批量导入数据时,此属性必须string-空
del_server否删除行数据的后端API链接,若del_btn_visible属性返回true时,此属性必须string-空
upload_server否文件上传后端API链接,若表单中包含有上传文件控件时,此属性必须string-空
token否后端需要的token信息string-空
page否当前页码的参数名string-page
limit否每页显示条数number-20
height否列表表格高度string-300px
size否列表中的按钮及表单样式大小stringlarge, default, smalldefault
operate_width否操作列的宽度, 若行中有操作按钮,此值必须大于0,否则 操作列不显示number-0
detail_btn_visible否是否显示行详情按钮 , 默认不显示function-(select_row: AnyObject) => false
add_btn_visible否是否显示新增按钮 , 默认不显示boolean-false
edit_btn_visible否是否显示行编辑按钮 , 默认不显示function-(select_row: AnyObject) => false
del_btn_visible否是否显示行删除按钮 , 默认不显示function-(select_row: AnyObject) => false
checkbox否是否显示行选择复选框boolean-false
expand否是否显示行展开功能boolean-false
selectable否行是否可以选择的回调函数function-() => true
load_form否表单加载前的回调函数function-(tableService: AnyObject, select_row: AnyObject) => Promise.resolve(true)
row_key否树形数据唯一键字段,列表数据为树形时(即包含 children 字段时)此项必须string-空
default_expand_all否列表数据为树形时(即包含 children 字段时)是否全部展开boolean-true
export_file_name否列表数据导出的文件名称string-当前日期
expand_action否每行的操作按钮是否展开显示boolean-true
form_dialog_width否表单弹窗的宽度string-50%

插槽

插槽在模板中的具体使用,请参考“模板中使用”中的“完整功能”

插槽名说明
headerAction表格头部左边的自定义按钮操作
rowAction列表每行操作列的按钮操作自定义
formatRow每行中的每个字段内容 自定义格式化内容显示: 可获取参数有 { row, field },row=当前行数据,field=字段名
rowExpand行展开 自定义显示内容,可获取参数有 { row, index } row=当前行数据,index=行索引号

事件

事件名说明参数
exception列表加载数据异常事件msg 异常信息
beforeLoadTable列表表格数据加载前的回调tableService 列表服务类对象
afterLoadTable列表表格数据加载完后的回调table_config 列表配置对象

vue-vuecmf-dialog

介绍

vue-vuecmf-dialog弹窗组件是基于vue3、Element Plus和TypeScript构建,支持最大化、最小化、还原及弹窗主体内容自适应屏幕功能。

DownloadsVersionLicense

项目托管地址:

  1. Github: https://github.com/vuecmf/vue-vuecmf-dialog
  2. Gitee: https://gitee.com/emei/vue-vuecmf-dialog

演示

安装

使用

导入组件

然后在项目的main.ts 引入,如下

import { createApp } from 'vue'
import App from './App.vue'
import './registerServiceWorker'

/*导入组件*/
import VuecmfDialog from "vue-vuecmf-dialog"

createApp(App).use(VuecmfDialog).mount('#app')

模板中使用

<template>
  <h3>vue-vuecmf-dialog demo</h3>
  <el-button 
      size="default" 
      type="primary" 
      @click=" showDlg = true " >打开对话框</el-button>
  
  <vuecmf-dialog 
      :model_value="showDlg" 
      title="标题"  
      @updateVisible="updateVisible"  
      @close="close" 
      @toggleScreen="toggleScreen">

    <template #content>
      <div> 这是一个可以最大化、最小化及还原的 对话框</div>
    </template>

    <template #footer>
      <el-button type="primary" @click=" showDlg = false ">关闭</el-button>
    </template>

  </vuecmf-dialog>
</template>

<script lang="ts">
import {defineComponent, ref} from 'vue';

export default defineComponent({
  name: 'App',
  setup(){
    const showDlg = ref()
    showDlg.value = false

    const updateVisible = (val:any) => {
      console.log('val=', val)
      showDlg.value = val
    }

    const close = ():void => {
       console.log('dialog closed!')
    }
    
    const toggleScreen = (is_max: boolean):void => {
       console.log('dialog is max:', is_max)
    }

    return {
     showDlg,
     updateVisible,
     close,
     toggleScreen
    }
  }
});
</script>

属性

属性必须说明类型可选值默认值
title否对话框标题,支持htmlstring-空
max_screen否是否全屏显示bool-false
width否对话框宽度string-50%
top否对话框顶部相对于窗口的偏移距离string-15vh
model_value否是否显示对话框bool-false
custom_class否Dialog 的自定义样式类名string-空
close_on_click_modal否是否可以通过点击 modal 关闭 Dialogbool-false
close_on_press_escape否是否可以通过按下 ESC 关闭 Dialogbool-true
show_close否是否显示关闭按钮bool-true
scroll_top否每次打开弹窗是否滚动到弹窗头部位置bool-true
modal否是否显示遮罩层bool-true
append_to_body否Dialog 自身是否插入至 body 元素上。 嵌套的 Dialog 必须指定该属性并赋值为 truebool-false

事件

事件名说明参数
openDialog 打开时的回调-
openedDialog 打开后的回调-
closeDialog 关闭的回调-
closedDialog 关闭后的回调-
updateVisible弹窗关闭时,重置为弹窗不显示-
toggleScreen弹窗最大化及还原时的回调is_max: bool值,当前弹窗是否最大化

vue-vuecmf-editor

介绍

vue-vuecmf-editor是一款基于vue3、Element Plus和TypeScript构建的HTML5富文本编辑器。

DownloadsVersionLicense

项目托管地址:

  1. Github: https://github.com/vuecmf/vue-vuecmf-editor
  2. Gitee: https://gitee.com/emei/vue-vuecmf-editor

演示

安装

使用

导入组件

然后在项目的main.ts 引入,如下

import { createApp } from 'vue'
import App from './App.vue'
import './registerServiceWorker'

//导入
import VuecmfEditor from "vue-vuecmf-editor"

createApp(App).use(VuecmfEditor).mount('#app')

模板中使用

<template>
  <h3>vuecmf-editor demo</h3>

  <vuecmf-editor
      id="myeditor"
      :content="contentHtml"
      @on-change="getContent"
  ></vuecmf-editor>
  <button @click="save">保存</button>

</template>


<script lang="ts">
import {defineComponent, ref} from 'vue';

export default defineComponent({
  name: 'App',
  components: {
  },
  setup(){
    const contentHtml = ref('Hello world!')

    const getContent = (content:string, id: string) => {
      console.log('id=', id)
      contentHtml.value = content
    }

    const save = ():void => {
      alert(contentHtml.value)
    }

    return {
      getContent,
      contentHtml,
      save
    }

  }
});
</script>

属性

属性必须说明类型可选值默认值
id是编辑器idstring--
content否编辑器内容string-空
height否编辑器高度string-300px
size否编辑器中工具条大小样式stringdefault, large, smalldefault
tools否自定义工具条,多个英文逗号分隔。例如 heading,table,codestringheading 标题
align-left 左对齐
align-center 居中对齐
align-right 右对齐
bold 加粗
italic 斜体
underline 下横线
strikethrough 删除线
superscript 上角标
subscript 下角标
quote-left 块引用
link 添加超链接
unlink 取消超链接
font 字体
font-size 字大小
font-color 字体颜色
font-bg-color 文本背景色
indent 增加缩进
outdent 减少缩进
list-ol 有序列表
list-ul 无序列表
select-all 全选
remove-format 清除格式
cut 剪切
copy 复制
hr 插入水平线
table 插入表格
image 插入图片
film 插入视频
code 插入代码
redo 恢复
undo 撤销
空

事件

事件名说明参数
on-change添加或修改编辑器中的内容时,触发此事件content: 编辑器内容, id: 编辑器ID