1.0.2 • Published 2 years ago

xjh-components v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

xjh-components

介绍

本项目是基于Element-UI扩展的常用组件库。

使用方式

安装:
npm install xjh-components -S
引入:
import XJHComponents from 'xjh-components'
import 'xjh-components/lib/xjh-components.css'

Vue.use(XJHComponents)

组件

  1. 动态表单组件JsonForm:
    Attributes
    参数说明类型默认值可选值
    inline行内表单模式Booleanfalse-
    label-width表单域标签的宽度,例如 '50px'。作为 Form 直接子元素的 form-item 会继承该值。支持 auto。Stringauto-
    json表单配置数组jsonItem,jsonItem配置详见下表Array[]-
    model表单数据对象Object{}-
    label-position表单域标签的位置,如果值为 left 或者 right 时,则需要设置 label-widthStringrightright/left/top
    jsonItem
    参数说明类型默认值可选值
    label标签文本String--
    type组件类型String-text/input/textarea/inputNumber/select/selectRemote/button/switch/checkbox/radio/datePicker/timePicker/cascader/table/image/colorPicker/slider/stake
    key对应表单数据对象model字段名称String--
    placeholder占位符String--
    option可选项数据源,仅type为select/selectRemote/radio/checkbox/cascader时有效Array[]-
    validate表单验证规则Object/Array--
    disabled是否禁用Booleanfalse-
    maxlength最大输入长度,仅type为input/textarea有效Number--
    readonly是否只读,仅type为input/image有效Booleanfalse-
    min设置计数器允许的最小值,仅type为inputNumber有效Number-Infinity-
    max设置计数器允许的最大值,仅type为inputNumber有效NumberInfinity-
    precision数值精度,仅type为inputNumber有效Number--
    step计数器步长,仅type为inputNumber有效Number1-
    componentType组件二级类型,仅type为select/datePickerString-group/date
    hideClear是否隐藏清空选项,仅type为select有效Booleanfalse-
    multiple是否可以多选,仅type为select有效Booleanfalse-
    collapseTags多选时是否将选中值按文字的形式展示,仅type为select/cascader有效Booleanfalse-
    filterable是否可搜索,仅type为select有效Booleanfalse-
    valueKey作为 value 唯一标识的键名,绑定值为对象类型时必填,仅type为select有效Stringvalue-
    loading是否正在从远程获取数据,仅type为selectRemote有效Booleanfalse-
    onClick点击事件,仅type为button有效Function--
    format时间显示格式,形如yyyy-MM-dd hh:mm:ss,仅type为datePicker/timePicker时有效String--
    arrowControl是否使用箭头进行时间选择,仅type为timePicker有效Booleanfalse-
    pickerOptions当前时间日期选择器特有的选项,同中picker-options,仅type为datePicker/timePicker有效Object{}-
    isRange是否为时间范围选择,仅type为timePicker有效Booleanfalse-
    startPlaceholder范围选择时开始日期的占位内容,仅type为datePicker有效String--
    endPlaceholder范围选择时结束日期的占位内容,仅type为datePicker有效String--
    props级联选择器配置项,同中props,仅type为cascader有效Object{}-
  2. 动态表格组件JsonTable:
    Attributes
    参数说明类型默认值可选值
    heightTable 的高度,默认为自动高度。如果 height 为 number 类型,单位 px;如果 height 为 string 类型,则这个高度会设置为 Table 的 style.height 的值,Table 的高度会受控于外部样式。String/Numberfalse-
    loading是否显示加载数据动效Booleanfalse-
    stripe是否为斑马纹 tableBooleanfalse-
    json表格配置项,详见下表Object{ tbody: [], thead: [] }-
    highlight是否要高亮当前行Booleanfalse-
    row-key行数据的Key,用来优化 Table 的渲染。String--
    check-on-click是否点击行时触发toggleRowSelection事件Booleanfalse-
    json
    参数说明类型默认值可选值
    thead.label显示的标题String--
    thead.column对应列内容的字段名String--
    thead.width对应列的宽度String--
    thead.align对齐方式Stringleftleft/center/right
    thead.fixed列是否固定在左侧或者右侧,true 表示固定在左侧String/Booleanfalsetrue/false/left/right
    thead.slot是否为插槽Booleanfalse-
    tbody表格数据Array[]-
    index索引列配置Objetc{}-
    selection多选表格配置Objetc{}-
    index
    参数说明类型默认值可选值
    enable是否开启Booleanfalse-
    width索引列宽度String/Number--
    label显示的标题String--
    formatter自定义索引number, Function(index)--
    selection
    参数说明类型默认值可选值
    enable是否开启Booleanfalse-
    width列宽度String/Number--
    reserveSelection在数据更新之后保留之前选中的数据(需指定 row-key)Booleanfalse-
    Event
    事件说明参数
    select当用户手动勾选数据行的 Checkbox 时触发的事件selection, row
    select-all当用户手动勾选全选 Checkbox 时触发的事件selection
    selection-change当选择项发生变化时会触发该事件selection
    current-change当表格的当前行发生变化的时候会触发该事件,如果要高亮当前行,请打开表格的 highlight-current-row 属性currentRow, oldCurrentRow
    row-click当某一行被点击时会触发该事件row, column, event
    item-click当某单元格被点击时会触发该事件row
  3. 分页表格组件PaginationTable:
    Attributes
    参数说明类型默认值可选值
    table表格配置项,同中jsonObject{}-
    table-height表格高度String/Number300-
    load-created是否在created中触发读取第一页数据操作Booleantrue-
    check-on-click是否点击行时触发toggleRowSelection事件Booleantrue-
    row-key行数据的Key,用来优化 Table 的渲染。Stringid-
    highlight是否要高亮当前行Booleanfalse-
    fetch-data获取表格数据方法Functionnew Promise((resolve, reject) => { resolve({}) })-
    pagination-center分页组件是否居中显示Booleantrue-
    page-size每页显示条目个数Number10-
    Event
    事件说明参数
    select当用户手动勾选数据行的 Checkbox 时触发的事件selection, row
    select-all当用户手动勾选全选 Checkbox 时触发的事件selection
    selection-change当选择项发生变化时会触发该事件selection
    current-change当表格的当前行发生变化的时候会触发该事件,如果要高亮当前行,请打开表格的 highlight-current-row 属性currentRow, oldCurrentRow
    row-click当某一行被点击时会触发该事件row, column, event