• CRUD文档
    • Variables
    • Option Attributes
    • Props Attributes
    • Type Attributes
    • Format Attributes
    • Column Attributes
    • Search Attributes
    • Events
    • Methods
    • Scoped Slot

    CRUD文档

    Variables

    参数说明类型可选值默认值
    before-open打开前的回调,会暂停Dialog的打开function(done,type),done用于关闭Dialog,type为当前窗口的类型Function
    before-close关闭前的回调,会暂停Dialog的关闭function(done,type),done用于关闭Dialog,type为当前窗口的类型Function
    cell-class-name单元格的className的回调方法,也可以使用字符串为所有单元格设置一个固定的className,function({row,column,rowIndex,columnIndex})/StringFunction--
    data显示的数据Array
    header-cell-class-nameheader-cell-class-name表头单元格的className的回调方法,也可以使用字符串为所有表头单元格设置一个固定的className,function({row,column,rowIndex,columnIndex})/StringFunction--
    option组件配置属性,详情见下面Option属性Object
    page分页配置选项,具体看下表Object
    row-class-name行的className的回调方法,也可以使用字符串为所有行设置一个固定的className,function({row,rowIndex})Function--
    span-method合并行或列的计算方法Function({row,column,rowIndex,columnIndex})Function--
    summary-method自定义的合计计算方法Function({columns,data})Function--
    table-loading表格等待框的控制Booleantrue/falsefalse
    upload-before图片上传前的回调,会暂停图片上传function(file,done),done用于继续图片上传,loading用于中断操作Function
    upload-after图片上传后的回调,function(res,done),done用于结束操作,loading用于中断操作Function

    Option Attributes

    参数说明类型可选值默认值
    addBtn添加按钮Booleantrue/falsetrue
    addRowBtn表格行内添加按钮Booleantrue/falsefalse
    align表格列齐方式Stringleft/center/rightleft
    border表格边框Booleantrue/falsefalse
    calcHeight表格高度差(主要用于减去其他部分让表格高度自适应)Numberauto
    cancelBtnTitle弹出框取消按钮标题String取消
    columnBtn列显隐按钮Booleantrue/falsetrue
    dataType数据的类型Stringnumber/string-
    cellBtn表格单元格可编辑(当column中有搜索的属性中有cell为true的属性启用,只对type为select和input有作用)Booleantrue/falsetrue
    dateBtn日期组件按钮Booleantrue/falsefalse
    cancelBtn行编辑取消按钮Booleantrue/falsetrue
    dateDefault日期控件默认的值Booleantrue/falsefalse
    dicData传入本次需要的静态字典(在column中dicData写对象key值即可加载)Object--
    dicMethod传入字典的请求方式Stirngget/postget
    dicQuery传入字典的请求参数Object--
    dicUrl字典的网络请求接口(例如配置/xxx/xx/{{key}},这样的格式,在column中dicData自动匹配prop字段名)String--
    delBtn行内删除按钮Booleantrue/falsetrue
    defaultSort表格的排序字段{prop:'date',order:'descending'}prop默认排序字段,order排序方式Object-
    dialogFullscreen是否为全屏DialogBooleantrue/falsefalse
    dialogEscape是否可以通过按下ESC关闭DialogBooleantrue/falsetrue
    dialogClickModal是否可以通过点击modal关闭DialogBooleantrue/falsetrue
    dialogCloseBtn是否显示关闭按钮Booleantrue/falsetrue
    dialogModal是否需要遮罩层Booleantrue/falsetrue
    dialogTop弹出表单的弹窗具体顶部的距离String/Number-35
    dialogWidth弹出表单的弹窗宽度String/Number-60%
    dialogHeight弹出表单的弹窗高度String/Number-400
    defaultExpandAll是否默认展开所有行,"expand"为true的时候有效Booleantrue/falsefalse
    expandRowKeys可以通过该属性设置目前的展开行,需要设置 idKey 属性才能使用,该属性为展开行的 keys 数组。Array--
    editBtn行内编辑按钮Booleantrue/falsetrue
    empty-text空数据时显示的文本内容,也可以通过slot="empty"设置String-暂无数据
    expand是否展开折叠行Booleantrue/falsefalse
    excelBtn打印按钮Booleantrue/falsefalse
    filterBtn自定义过滤按钮Booleantrue/falsefalse
    formWidth表单的宽度String/Number-100%
    height表格高度Numberauto
    header头部显隐Booleantrue/falsetrue
    index是否显示表格序号(根据分页会自动计算,比如每页10行,到了第二页就会从11开始记数)Booleantrue/falsefalse
    indexLabel序号的标题String#
    rowKey行数据的 Key的主键,用于其他相关操作Stringid
    indeterminate设置 indeterminate 状态,只负责样式控制 如果选择一半,不会出现半选Booleanfalse
    labelWidth弹出表单的label宽度Number-110
    maxHeight表格最大高度Numberauto
    menu是否显示操作菜单栏Booleantrue/falsetrue
    menuWidth操作菜单栏的宽度Number-240
    menuXsWidth手机端时操作菜单栏的宽度Number-100
    menuAlign菜单栏对齐方式Stringleft/center/rightleft
    menuType操作栏菜单按钮类型Stringbutton/icon/text/menutext
    menuBtnTitle菜单按钮的文字String-功能
    pageSize每页显示多少条String
    pageSizes分页的数组分段Array[10,20,30,50,100]
    printBtn打印按钮Booleantrue/falsefalse
    refreshBtn刷新按钮Booleantrue/falsetrue
    saveBtnTitle弹出新增按钮标题String新增
    selection行可勾选Booleantrue/falsefalse
    searchBtn搜索显隐按钮(当column中有搜索的属性,或则searchsolt为true时自定义搜索启动起作用)Booleantrue/falsetrue
    selectClearBtn清空选中按钮(当selection为true起作用)Booleantrue/falsetrue
    showHeader是否显示表格的表头Booleantrue/falsetrue
    showSummary是否在表尾显示合计行Booleantrue/falsefalse
    size控件大小Stringmedium/small/minimedium
    sumColumnList表格合计需要配置的字段Array--
    stripe是否显示表格的斑马条纹Booleantrue/falsefalse
    tip弹窗编辑文字提示String--
    tipPlacement弹窗编辑文字提示展示方向Stringtop-start/top/top-end/left-start/leftleft-end/right-start/right/right-endbottom-start/bottom/bottom-end-
    title表格标题String表格标题
    checkStrictly不遵循父子规则Booleantrue/falsetrue
    updateBtnTitle弹出框更新按钮标题String修改
    viewBtn查看按钮Booleantrue/falsefalse
    width表格宽度Number100%

    Props Attributes

    参数说明类型可选值默认值
    label字典的名称属性值String
    value字典的值属性值String
    children字典的子属性值String
    res网络字典返回的数据格式String

    Type Attributes

    TIP

    这是type属性可以配置的组件,当然你也可以自定义,参考第三方组件导入

    参数类型
    cascader级联框
    checkbox多选框
    date日期框
    datetime日期时间框
    daterange日期范围
    datetimerange日期时间范围
    dates多个日期
    dynamic动态输入框
    input输入框
    month
    password密码框
    radio单选框
    select选择框
    switch开关框
    textarea文本框
    time时间框
    timerange时间范围
    tree树框
    week
    year

    Format Attributes

    使用format指定输入框的格式;使用valueFormat指定绑定值的格式。

    默认情况下,组件接受并返回Date对象。以下为可用的格式化字串,以UTC2017年1月2日03:04:05为例:

    WARNING

    请注意大小写

    格式含义备注举例
    yyyy2017
    M不补01
    MM01
    W仅周选择器的format可用;不补01
    WW仅周选择器的format可用01
    d不补02
    dd02
    H小时24小时制;不补03
    HH小时24小时制03
    h小时12小时制,须和Aa使用;不补03
    hh小时12小时制,须和Aa使用03
    m分钟不补04
    mm分钟04
    s不补05
    ss05
    AAM/PMformat可用,大写AM
    aam/pmformat可用,小写am
    timestampJS时间戳value-format可用;组件绑定值为number类型1483326245000

    Column Attributes

    参数说明类型可选值默认值
    accept为upload时文件类型String/Array-
    addDisabled表单新增时是否禁止Booleantrue/falsefalse
    addDisplay表单新增时是否可见Booleantrue/falsetrue
    align对其方式Stringleft/center/rightleft
    append后面的辅助文字(当type为input))String/Number--
    cell行可编辑时,当前列是否可编辑Booleantrue/falsefalse
    clearable表单清空Booleantrue/falsefalse
    disabled全部是否禁止Booleantrue/falsefalse
    editDisabled表单编辑时是否禁止Booleantrue/falsefalse
    editDisplay表单编辑是否可见Booleantrue/falsetrue
    endPlaceholder日期范围结束占位符String--
    filesize为upload时文件的大小Number--
    filterMultiple数据过滤的选项是否多选Booleantrue/falsetrue
    filters数据过滤的选项,数组格式,数组中的元素需要有text和value属性。Array[{text,value}]--
    filterMethod数据过滤使用的方法,如果是多选的筛选项,对每一条数据会执行多次,任意一次返回true就会显示。Function(value,row,column)--
    fixed冻结列Booleantrue/falsefalse
    filterable是否可以输入搜索。Booleantrue/falsefalse
    formatter用来格式化内容Function(row,value,label,column)--
    formHeight表单行高度Number-auto
    format显示值时间格式(当type为date/time/datetime/daterangetimerange/datetimerange/week/month/year/dates---
    formslot表单自定义Booleantrue/falsefalse
    typeslot表单组件自定义Booleantrue/falsefalse
    formWidth表单行高度Number/String-50%
    hide隐藏列Booleantrue/falsetrue
    label列名称String-
    maxRows最大行(当type为textarea)Number-4
    minRows最小行(当type为textarea)Number-2
    minWidth列最小宽度Stringauto
    multiple多选(当type为select/tree时)Booleantrue/falsefalse
    overHidden超出隐藏Booleantrue/falsefalse
    placeholder辅助语String请选择/请输入+label
    prepend前面的辅助文字(当type为input)String/Number--
    precision数字框输入精度(当type为number时)Number-2
    prop列字段String-
    readonly只读Booleantrue/falsefalse
    rules表单规则,参考ele表单规则配置Object--
    size表单大小Stringmedium/small/minimedium
    showColumn是否加入动态现隐列Booleantrue/falsetrue
    sortable排序Booleantrue/falsefalse
    slot列自定义Booleantrue/falsefalse
    span表单栅列Number-12
    gutter项之间的间Number-20
    startPlaceholder日期范围开始占位符String--
    type类型Stringinput/select/radio/checkbox/textarea/cascader/date/time/datetime/daterange/timerange/datetimerange/week/month/year/dates/password/switch/treeinput
    valueDefault表单的默认值Number/String--
    valueFormat真实值的时间格式(当type为date/time/datetime/daterangetimerange/datetimerange/week/month/year/dates)---
    display全部是否可见Booleantrue/falsetrue
    viewDisplay表单查看是否可见Booleantrue/falsetrue
    tagsselect组件多选时是否超出后合并标签Booleantrue/falsefalse
    width列宽度Stringauto

    Search Attributes

    参数说明类型可选值默认值
    searchDefault搜索表单的默认值Number/String--
    searchPlaceholder搜索框的辅助文字String-label
    searchClearable搜索框的清除按钮Booleantrue/falsefalse
    searchMmultiple搜索表单的是否多选Booleantrue/falsefalse
    searchFilterable是否可以输入搜索。Booleantrue/falsefalse
    searchFilterMethod数据过滤使用的方法,如果是多选的筛选项,对每一条数据会执行多次,任意一次返回true就会显示。Function(value,row,column)--
    searchSize搜索框的大小Stringsmall/minismall
    searchShow首次加载是否显示搜索Booleantrue/falsetrue
    searchTipPlacement搜索文字提示展示方向Stringtop-start/top/top-end/left-start/leftleft-end/right-start/right/right-endbottom-start/bottom/bottom-end-
    searchTip弹窗编辑文字提示String--

    Events

    事件名说明参数
    current-change切换页面时触发该事件page
    current-row-change当表格的当前行发生变化的时候会触发该事件,如果要高亮当前行,请打开表格的highlightCurrentRow属性为truecurrentRow,oldCurrentRow
    select单个选择回调selection, row
    selectAll勾选全选selection
    date-change表格日期回调方法date
    filter-change过滤回调函数params
    cell-mouse-enter当单元格 hover 进入时会触发该事件row, column, cell, event
    cell-mouse-leave当单元格 hover 退出时会触发该事件row, column, cell, event
    cell-click当某个单元格被点击时会触发该事件row, column, cell, event
    cell-dblclick当某个单元格被双击击时会触发该事件row, column, cell, event
    row-update编辑数据后确定触发该事件row,index,done,loading
    row-save新增数据后点击确定触发该事件row,done,loading
    row-del行数据删除时触发该事件row,index
    row-click当某一行被点击时会触发该事件row,event,column
    row-dblclick当某一行被双击时会触发该事件row,column
    refresh-change点击刷新按钮触发该事件page
    size-change页面每页显示的条数触发该事件pageSize
    sort-change调用排序后触发该事件list
    search-change点击搜索后触发该事件params
    search-reset清空搜索回调方法-
    selection-change当选择项发生变化时会触发该事件selection
    toggleRowExpansion用于可展开表格,切换某一行的展开状态,如果使用了第二个参数,则是设置这一行展开与否(expanded 为 true 则展开row, expanded

    Methods

    方法名说明参数
    clearValidate清空表格钟表单验证。
    rowAdd打开表单新增窗口
    rowEdit打开表单编辑窗口row,index
    rowCell打开行编辑row,index
    rowPrint打印表格
    rowExcel导出表格
    resetForm清空表单数据
    setCurrentRow用于单选表格,设定某一行为选中行,如果调用时不加参数,则会取消目前高亮行的选中状态。row
    selectClear用于多选表格,清空用户的选择。
    searchReset清空搜索栏目的值
    toggleSelection用于多选表格,切换所有行的选中状态。

    Scoped Slot

    name说明
    列的名称列自定义列的内容,参数为{row,label,dic,$index}
    列表单的名称+Form(nameForm)表单自定义列的内容,参数为{row,label,dic,$index}
    列表单的名称+Type(nameType)表单自定义列的内容,参数为{row,label,value}
    empty暂无数据的自定义卡槽
    expand折叠板的自定义内容,参数为{row,label,dic,$index}
    menu菜单的操作按钮自定义内容,参数为{row,label,dic,$index}
    menuForm表单操作按钮的自定义内容,参数为{row,label,dic,$index}
    menuLeft表格头部左侧内容
    menuRight表格头部右侧内容
    menuBtn操作栏目下拉菜单自定义(要用el-dropdown-item组件包裹起来),参数为{row,label,dic,$index}
    search搜索栏目自定义内容
    searchMenu搜索栏目菜单自定义内容