1.2.1 • Published 11 months ago

miniprogram-table v1.2.1

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

miniprogram-table

小程序表格组件,包含复选框功能

安装方式

1. 直接拷贝dist目录到组件目录下

2. npm安装

npm install miniprogram-table

构建npm

使用组件

引入table组件

{
  "usingComponents": {
    "comp-table": "componentsPath/index"
  }
}
<comp-table
    id="comp-table"
    headers="{{headers}}"
    data="{{datas}}"
    highlight-class="highlight"
    enable-checkbox="{{enableCheckbox}}"
/>
.highlight {
	background: orange !important;
	font-weight: bold;
}

属性

属性类型默认值说明
headersArray[]表头
header.propString字段
header.labelString表头文本
header.idBooleanfalse是否为主键
header.widthNumber150列宽度
header.fixedBooleanfalse是否固定该列到左侧
header.sortBooleanfalse使用该列进行排序,如果为function,将作为排序时比较两个数据大小的回调,接受两个参数:a和b,只需要返回a是否大于b即可
dataArray[]表格数据
msgString'一条数据都没有'当表格中没有任何数据时,显示的提示文本
enableCheckboxBooleanfalse是否启用复选框,仅在指定有主键时有效
heightString'50vh'表格高度
highlight-classString高亮行样式类
header-classString表头自定义样式类
cell-classString自定义单元格样式
stripeBooleanfalse是否显示条纹
stripe-colorString'#e5e5e5'条纹颜色

事件

事件detail说明
select{selectAll:boolean, selectedCount: number, selected: Array}复选框事件
headerClick{col: string, sortOrder: string}表头被点击时触发的事件{被点击的列,该列排序方式(仅在该列sort为true时返回)

方法

通过this.selectComponent('#id')组件实例调用的方法

方法参数说明
getSelected-获取选中数据

更新说明

v1.2.0

  • 新增headerClick事件
  • 修改header.sort的值只能为true or false
1.2.0

11 months ago

1.1.1

11 months ago

1.1.0

11 months ago

1.2.1

11 months ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago