Skip to content

Commit

Permalink
Merge pull request #3 from kawaiiz/dev
Browse files Browse the repository at this point in the history
210129 删除项目依赖,添加scroll-x功能,修改readme.md
  • Loading branch information
mmmml-zhao authored Jan 29, 2021
2 parents f3e3be4 + aa98303 commit 518ceb0
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
|scrollViewHeight|控制可滚动区域高度。|string| 600rpx|false |
|tipTitle| 无数据时的提示文本主标题 | string | 提示 | false |
|tipSubtitle| 无数据时的提示文本副标题 | string | 暂无数据| false |
|scrollX| 是否需要X轴滚动。 | boolean | false| false |
|select| 控制是否出现勾选。 | boolean | false| false |
|selectKeys| 勾选的初始值 | any[] | []| false |
|generic:action-td| 当列表项内具有操作列,需要在`columns`内添加`type:action`的一项,操作列的内容往往需要自定义,小程序不提供react,vue的`rander函数`,所以使用到了抽象节点,该属性指明抽象节点的组件。操作列位置可以不固定,点击事件由`bindclickaction`触发 | component |undefined | false |
Expand Down
6 changes: 6 additions & 0 deletions miniprogram/pages/index/components/parameter/parameter.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ Component({
type: 'string',
init: `暂无数据`,
require: false,
}, {
key: 'scrollX',
desc: '是否需要X轴滚动',
type: 'boolean',
init: `false`,
require: false,
}, {
key: 'select',
desc: '控制是否出现勾选。',
Expand Down
6 changes: 6 additions & 0 deletions miniprogram/pages/index/components/parameter/parameter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ Component<InitData, InitProperty, InitMethod>({
type: 'string',
init: `暂无数据`,
require: false,
}, {
key: 'scrollX',
desc: '是否需要X轴滚动',
type: 'boolean',
init: `false`,
require: false,
}, {
key: 'select',
desc: '控制是否出现勾选。',
Expand Down
1 change: 0 additions & 1 deletion miniprogram/public/components/public/table/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ Component({
});
},
handleTouchEnd(e) {
console.log(e);
const { scrollX, scrollTag } = this.data;
if (!scrollX)
return;
Expand Down
24 changes: 20 additions & 4 deletions miniprogram/public/components/public/table/table.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# 使用说明

该组件具有 列表展示模式,勾选模式
该组件具有 列表展示模式,勾选模式,展开行模式。
1. 复制`/miniprogram/public/components/public`下面的三个组件,到你的公共组件文件夹下(其实这三个组件也是也可以合为一体,因为empty与load_more组件是可以单独使用的,所以没有放到table组件中)
2. 在需要使用的页面引入table组件即可。

1. 属性介绍
# API

## prop

| 参数 | 说明 | 类型 | 默认值 | 是否必填 |
|-----|-----|-----|-----|-----|
Expand All @@ -14,6 +18,7 @@
|scrollViewHeight|控制可滚动区域高度。|string| 600rpx|false |
|tipTitle| 无数据时的提示文本主标题 | string | 提示 | false |
|tipSubtitle| 无数据时的提示文本副标题 | string | 暂无数据| false |
|scrollX| 是否需要X轴滚动。 | boolean | false| false |
|select| 控制是否出现勾选。 | boolean | false| false |
|selectKeys| 勾选的初始值 | any[] | []| false |
|generic:action-td| 当列表项内具有操作列,需要在`columns`内添加`type:action`的一项,操作列的内容往往需要自定义,小程序不提供react,vue的`rander函数`,所以使用到了抽象节点,该属性指明抽象节点的组件。操作列位置可以不固定,点击事件由`bindclickaction`触发 | component |undefined | false |
Expand All @@ -25,7 +30,7 @@
|dynamicValue| 给自定义内容的动态值,用于改变状态 ,建议{value:放的数据} | object | {} |false |


2. 事件介绍
## event

|事件 | 解释| 类型|
|-----|-----|-----|
Expand All @@ -34,4 +39,15 @@
|bindclickaction| 点击抽象节点事件 |Function(e); e.detail.value = {type:(这个按钮的含义字段,如‘close’),index:(当前的行),item:(当前行的数据)};(这是我这里定义的结构,具体可以自己定义在action-td里)}|
|bindcheckkey| 勾选事件 返回被勾选项的rowKey数组 |Function(e); e.detail.value = any[]//(数组内每一项是rowKey字段定义的数据的toString()结果)|
|bindscrolltolower| 滚动触底 | Function() |
|bindscrolltoupper| 滚动触顶 | Function() |
|bindscrolltoupper| 滚动触顶 | Function() |

## column
列描述数据对象,是 columns 中的一项,Column 使用相同的 API。

|事件 | 解释| 类型| 必填|
|-----|-----|-----|-----|
|title|字段名中文含义|string| true|
|key|字段名|string| true|
|width|单元格宽度|string| false|
|type|判断字段是否是自定义组件|'action'/undefined | false|
|render|td内内容由函数返回 (value: any, item: any, index: number, data?: 当前页面的this.data) => any,// 设置内容|function| false|
2 changes: 1 addition & 1 deletion miniprogram/public/components/public/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ Component<InitData, InitProperty, InitMethod>({
},
// 主要是为了监听横向滚动
handleTouchEnd(e) {
console.log(e)
// console.log(e)
const { scrollX, scrollTag } = this.data
if (!scrollX) return
const { tag } = e.currentTarget.dataset
Expand Down

0 comments on commit 518ceb0

Please sign in to comment.