HtUI使用文档


一、HtUI是什么

HtUI是基于ElementUI@2.14进行二次开发的一套UI库 并且该文档中的HtUI版本是大于等于@1.3.58。
HtUI源码库请移步这里


二、使用步骤

1.引入库

代码如下:

yarn add htui-yllkbz
import Htui from "htui-yllkbz"
import "htui-yllkbz/lib/htui.css";
Vue.use(Htui);

2.组件库

1.HtExport–导出文件

组件使用说明:主要用于附件的导出 将主要的导出方法进行了统一封装处理

 <ht-export method="method" :url="url" :exportBefore="exportBeforeFunc" :fileName="fileName"></ht-export>

Attributes/Events:

参数名说明类型可选值默认值
method请求方式(必填)stringget,post-
url请求地址(必填)string--
file-name导出文件名,如果不传则取后端传过来的文件名string--
export-before是否允许导,默认允许导出boolean-true

Slot:

名称说明
-自定义导出按钮

2.HtDrawer–抽屉

组件使用说明:对el-drawer进行了优化和封装 ,默认添加了foot以及对body内容进行滚动条处理

 
    <ht-drawer
      v-model="state.visible"
      :title="title"
      @onOk="onOk"
      @onCancel="onCancel"
    >
     ...
     body
     ...
    </ht-drawer>

Attributes/Events:

参数名说明类型可选值默认值
value是否打开弹窗booleantruefalse
loading按钮的加载状态booleantruefalse
title抽屉名称string--
size尺寸string-50%
direction弹出方向string-参考element-drawer
append-to-bodyDrawer 自身是否插入至 body 元素上。嵌套的 Drawer 必须指定该属性并赋值为 truebooleantrue,falsetrue
wrapper-closable是否可以通过按下 ESC 关闭 Drawerboolean-false
close-on-press-escape是否可以通过按下 ESC 关闭 Drawerrboolean-false
destroy–on-close控制是否在关闭 Drawer 之后将子元素全部销毁boolean-false
modal是否需要遮罩层boolean-true
custom-classDrawer 的自定义类名string--
modal-append-to-body遮罩层是否插入至 body 元素上,若为 false,则遮罩层会插入至 Drawer 的父元素上boolean-true
show-close是否展示右上角的关闭图标boolean-true
with-header控制是否显示 header 栏, 默认为 true, 当此项为 false 时, title attribute 和 title slot 均不生效boolean-true
with-footer控制是否显示 foot 栏, 默认为 true, 当此项为 false 时, foot attribute 和 foot slot 均不生效boolean-true
@onOk用户点击foot里面的确定按钮时候调用该方法Function--
@onCancel用户点击foot里面的确定按钮时候调用该方法Function--

Slot:

名称说明
-Drawer中body的内容
titleDrawer 标题区的内容
footDrawer中foo的内容

3.HtSelectUser–选择用户

组件使用说明:主要用于在系统中需要选择部门下用户时候或者查看用户时候使用

 <ht-select-user v-model="value"></ht-select-user>

Attributes/Events:

参数名说明类型可选值默认值
value/v-model人员IDstring--
org部门id,传入值之后就会根据该值自动过滤成该部门下的用户string--
size尺寸stringmedium / small / mini--
placeholder输入框占位文本string--
disabled是否禁用boolean-false
clearable是否可以清除boolean-false
multiple是否可以多选boolean-false
check-strictly是否严格的遵守父子节点不互相关联boolean-true
readonly是否只读boolean-false
show-all-levels输入框中是否显示选中值的完整路径boolean-true
collapse-tags多选模式下是否折叠Tagboolean-false
@change改变数值时候的回调Function-默认会代入当前id

4.HtSelectOrg–选择部门

组件使用说明:主要用于在系统中需要选择部门或者查看部门时候使用

 <ht-select-org v-model="value"></ht-select-org>

Attributes/Events:

参数名说明类型可选值默认值
value/v-model部门IDstring--
org部门id,传入值之后就会根据该值自动过滤成该部门以及该部门的子部门string--
size尺寸stringmedium / small / mini--
placeholder输入框占位文本string--
disabled是否禁用boolean-false
clearable是否可以清除boolean-false
multiple是否可以多选boolean-false
check-strictly是否严格的遵守父子节点不互相关联boolean-true
readonly是否只读boolean-false
show-all-levels输入框中是否显示选中值的完整路径boolean-true
collapse-tags多选模式下是否折叠Tagboolean-false
@change改变数值时候的回调Function-默认会代入当前id

4.HtSelectBaseData–选择基础数据

组件使用说明:主要用于在系统中需要选择基础数据时候使用

 <ht-select-base-data v-model="value"></ht-select-base-data>

Attributes/Events:

参数名说明类型可选值默认值
value/v-model部门IDstring--
dataTypeId基础数据的Value值(必填)string参考基础数据页面的Value-
org部门id,传入值之后就会根据该值自动过滤成该部门下面的基础数据string--
size尺寸stringmedium / small / mini--
placeholder输入框占位文本string--
disabled是否禁用boolean-false
clearable是否可以清除boolean-false
multiple是否可以多选boolean-false
check-strictly是否严格的遵守父子节点不互相关联boolean-true
readonly是否只读boolean-false
hide-code是否隐藏数据展示或选中时候的value值boolean-false
show-all-levels输入框中是否显示选中值的完整路径boolean-true
collapse-tags多选模式下是否折叠Tagboolean-false
by-code是否通过基础数据的value值来做唯一key,当前默认是通过id来选择值.当选择严重等级或响应等级时候必须传入trueboolean-false
@change改变数值时候的回调Function-默认会代入当前id

5.HtTable–table表格

组件使用说明:在系统中表格样式和功能统一封装(基于Element UI具体文档也可以参考https://element.eleme.cn/#/zh-CN/component/table),该组件主要提供了分页功能,列的自定义展示功能,列的拖动排序功能

 <ht-table
      :data="state.dataSource"
      @onchange="changePage"
      border
      height="calc(100vh - 200px)"
      highlight-current-row
      :page-info="{
        currentPage: state.currentPage,
        pageSize: state.maxResultCount,
        skipCount: state.skipCount,
        totalCount: state.totalCount,
      }"
      :columns="state.columns"
    >
      <template slot-scope="{ row }" slot="handel">
        <el-button type="text" style="margin-left:12px" @click="edit(row)"
          >编辑</el-button
        >
      </template>
    </ht-table>

Table Attributes:

参数名说明类型可选值默认值
data显示的数据array--
columns详情见Column属性Column[]--
heightTable 的高度,默认为自动高度。如果 height 为 number 类型,单位 px;如果 height 为 string 类型,则这个高度会设置为 Table 的 style.height 的值,Table 的高度会受控于外部样式。)string/number--
max-heightTable 的最大高度。合法的值为数字或者单位为 px 的高度。string/number--
stripe是否为斑马纹 tableboolean-true
border是否带有纵向边框boolean-true
fit列的宽度是否自撑开禁用boolean-true
show-header是否显示表头boolean-true
highlight-current-row是否要高亮当前行boolean-true
current-row-key当前行的 key,只写属性String,Number--
row-class-name行的 className 的回调方法,也可以使用字符串为所有行设置一个固定的 className。Function({row, rowIndex})/String--
row-style行的 style 的回调方法,也可以使用一个固定的 Object 为所有行设置一样的 Style。Function({row, rowIndex})/Object--
header-row-class-name表头行的 className 的回调方法,也可以使用字符串为所有表头行设置一个固定的 classNameFunction({row, rowIndex})/String--
header-row-style表头行的 style 的回调方法,也可以使用一个固定的 Object 为所有表头行设置一样的 Style。Function({row, rowIndex})/Object-{ background: ‘var(–primary-92)’ }
header-cell-class-name表头单元格的 className 的回调方法,也可以使用字符串为所有表头单元格设置一个固定的 classNameFunction({row, column, rowIndex, columnIndex})/String--
header-cell-style表头单元格的 style 的回调方法,也可以使用一个固定的 Object 为所有表头单元格设置一样的 Style。Function({row, column, rowIndex, columnIndex})/Object--
row-key行数据的 Key,用来优化 Table 的渲染;在使用 reserve-selection 功能与显示树形数据时,该属性是必填的。类型为 String 时,支持多层访问:user.info.id,但不支持 user.info[0].id,此种情况请使用 Function。Function(row)/String-id
empty-text空数据时显示的文本内容,也可以通过 slot=“empty” 设置(开发中)string-暂无数据
checked是否启用复选框boolean-false
selectKey设置禁用check行的字段 ,通过该字段来判断改行是否禁用,所以data数据中也必须包含该字段string-selectable
show-filter是否启用自定义列展示排序功能boolean-false
draggable是否可以拖动排序boolean-true
config-show为true时候默认表头就为空,否则就为初始的全部,需配合show-filter一起使用boolean-false
show-filter是否启用自定义列展示排序功能boolean-false
uu-idtable的唯一key用于缓存自定义列功能,推荐使用UUID格式string--
hide-order是否隐藏序号那一列boolean-false
key-name序号那列的头名称string-序号
hide-page是否隐藏分页boolean-false
page-info详情见pageInfo属性PageInfoType--
pagination分页的一些额外属性(如:hideOnSinglePage,small)object--
is-expand是否启用expand展开行boolean-false
span-method合并行或列的计算方法Function({ row, column, rowIndex, columnIndex })--
show-summary是否在表尾显示合计行boolean-false
sumText合计行第一列的文本string-合计
summaryMethod自定义合并方法Function({ columns, data })--

Column Attributes/Events:

参数名说明类型可选值默认值
currentPage唯一KEYstring--
title列名string--
width列宽string /number--
minWidth最小宽度string/number--
fixed列是否固定在左侧或者右侧,true 表示固定在左侧string, booleantrue, left, right-
sortable对应列是否可以排序,如果设置为 ‘custom’,则代表用户希望远程排序,需要监听 Table 的 sort-change 事件boolean, stringtrue, false, ‘custom’false
resizable对应列是否可以通过拖动改变宽度(需要在 el-table 上设置 border 属性为真)boolean-true
align对齐方式stringleft/center/rightleft
headerAlign表头对齐方式,若不设置该项,stringleft/center/rightleft
className列的 classNamestring--
labelClassName当前列标题的自定义类名string--
hide是否隐藏当前列boolean-false
deafaultShow默认是否显示boolean--
spread时间是否跨行显示(上下结构的时分秒-年月日)boolean-false
type数据自动解析时候的类型(人员ID,部门ID,时间,基础数据,布尔值,图片,附件)userId /org/ time/ common/ boolean/ img / file--
commonType只有当type='common’时候有效baseDataId /roleId/ baseDataName/baseDataValue--
hideode当type===common时候 设置是否隐藏基础数据的valueboolean--
showOverflowTooltip当内容过长被隐藏时显示 tooltipboolean-true
hideCode当type===common时候 设置是否隐藏基础数据的valueboolean--
disabled自定义列是否是否禁止操作该列boolean--
property自定义列时候展示额外信息string--
checked自定义列时候默认是否选中boolean--

PageInfo Attributes/Events:

参数名说明类型可选值默认值
currentPage当前第几页number--
pageSize每页最大条数number--
currentPage当前第几页number--
skipCount跳过多少条开始查询number--

Table Events:

主要的事件都可以参考Element UI官方 这里不在详细列出,只列出新增部分

参数名说明参数
onchange分页回调(data:PageType)
customColumn自定义列的回调(columns:Column[ ])

Table Slot:

name说明
${item.key}自定义列的内容,参数为 { row, column, $index },例如:当要修改column中key=age的内容,slot中name=age
header_${item.key}处理重定义table头相关信息 header_key,参数为{ {column, $index }例如:当要修改column中key=age的头部内容,slot中name=header_age
footerLeft自定义分页内容,当hidePage=true时候将失效,此处建议使用el-col
header_order排序列的头信息,自定义之后自定义排序功能失效,默认显示序号
body_order排序列的body信息,默认展示的是当前行所在的位置,参数为 { row, column, $index }
expand启用展开行之后的自定义展开行内容(is-expand=true才生效)

6.HtSelectCron–选择CRON表达式

组件使用说明:主要用于在系统中需要选择cron表达式时候使用,自动解析表达式内容

 <ht-select-cron v-model="value"></ht-select-cron>

Attributes/Events:

参数名说明类型可选值默认值
value/v-modelcron表达式string--
disabled是否禁用boolean-false
readonly是否只读boolean-false
@change改变数值时候的回调Function--

7.HtSelectTimeSlot–选择时间段(PT表达式)

组件使用说明:主要用于在系统中需要选择时间段(PT表达式)时候使用,自动解析表达式内容

 <ht-select-time-slot v-model="value"></ht-select-time-slot >

Attributes/Events:

参数名说明类型可选值默认值
value/v-modelcron表达式string--
disabled是否禁用boolean-false
readonly是否只读boolean-false
@change改变数值时候的回调Function--

其他

如果发现什么bug可以在评论区留言,正在不断完善中

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

玉林路扛把子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值