- 用于小程序table展示
- 图片只支持网络图片
- 采用rich-text渲染
- 不支持所有节点的事件
-
安装软件包
npm i @fearcleari/wetable
-
引用we-table
index.json / app.json "usingComponents": { "we-table": "@fearcleari/wetable" }
-
组件中书写对应的属性
index.wxml <we-table scroll="{{scroll}}" columns="{{columns}}" dataSource="{{dataSource}}" > </we-table>
index.js Page({ data: { columns: [ {dataIndex: 'name', title: 'Full Name', fixed: 'left', width: 100}, {dataIndex: 'age', title: 'Age',width: 100}, {dataIndex: 'address', title: 'Address'}, ], scroll: { x: 750, y: 300 }, dataSource: [ {name: 'Mike', age: 12, address: 'Nan.Street'}, {name: 'Mike', age: 12, address: 'Nan.Street'}, {name: 'Mike', age: 12, address: 'Nan.Street'}, {name: 'Mike', age: 12, address: 'Nan.Street'} ] } })
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
tableLayout | 表格元素的table-layout属性,设为fixed 表示内容不会影响列的布局 |
- | auto | fixed |
无 固定表头/列或使用了 column.ellipsis 时,默认值为fixed |