From 676031781b189a3a89dba9e57cb989c06999091a Mon Sep 17 00:00:00 2001 From: weisheng <1780903673@qq.com> Date: Wed, 1 May 2024 22:55:38 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E2=9C=8F=EF=B8=8F=20=20=E8=A1=A5?= =?UTF-8?q?=E5=85=85Table=E7=BB=84=E4=BB=B6=E5=85=B3=E4=BA=8EEvents?= =?UTF-8?q?=E7=9A=84=E4=BB=8B=E7=BB=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✅ Closes: #260 --- docs/component/table.md | 27 ++++++++++++------- .../components/wd-table/wd-table.vue | 2 +- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/docs/component/table.md b/docs/component/table.md index c5d604e8f..322ee9fa0 100644 --- a/docs/component/table.md +++ b/docs/component/table.md @@ -234,16 +234,23 @@ function handleSort(e) { ## Attributes -| 参数 | 说明 | 类型 | 可选值 | 默认值 | 最低版本 | -| ---------- | ------------------------------------------------- | ---------------------------- | ------ | ------ | ---------------- | -| data | 显示的数据 | Array | - | - | 0.0.39 | -| border | 是否带有边框 | boolean | - | true | 0.0.39 | -| stripe | 是否为斑马纹表 | boolean | - | true | 0.0.39 | -| height | Table 的高度,默认为`80vh` | string | - | `80vh` | 0.0.39 | -| rowHeight | 行高 | `number / string` | - | 50 | 0.0.39 | -| showHeader | 是否显示表头 | boolean | - | true | 0.0.39 | -| ellipsis | 是否超出 2 行隐藏 | boolean | - | true | 0.0.39 | -| index | 是否显示索引列,可传入`boolean`也可传入column配置 | `boolean / TableColumnProps` | | false | $LOWEST_VERSION$ | +| 参数 | 说明 | 类型 | 可选值 | 默认值 | 最低版本 | +| ---------- | --------------------------------------------------- | ---------------------------- | ------ | ------ | ---------------- | +| data | 显示的数据 | Array | - | - | 0.0.39 | +| border | 是否带有边框 | boolean | - | true | 0.0.39 | +| stripe | 是否为斑马纹表 | boolean | - | true | 0.0.39 | +| height | Table 的高度,默认为`80vh` | string | - | `80vh` | 0.0.39 | +| rowHeight | 行高 | `number / string` | - | 50 | 0.0.39 | +| showHeader | 是否显示表头 | boolean | - | true | 0.0.39 | +| ellipsis | 是否超出 2 行隐藏 | boolean | - | true | 0.0.39 | +| index | 是否显示索引列,可传入`boolean`也可传入 column 配置 | `boolean / TableColumnProps` | | false | $LOWEST_VERSION$ | + +## Events + +| 事件名称 | 说明 | 参数 | 最低版本 | +| ----------- | ------------------------------------------------------------------ | -------------------------------- | -------- | +| sort-method | 指定数据按照哪个属性进行排序,仅当 sortable 设置为 true 的时候有效 | `TableColumn:当前点击列数据` | 0.0.39 | +| row-click | 当某一行被点击时会触发该事件 | `{rowIndex:number} 点击行的下标` | 0.0.39 | ## TableColumn Attributes diff --git a/src/uni_modules/wot-design-uni/components/wd-table/wd-table.vue b/src/uni_modules/wot-design-uni/components/wd-table/wd-table.vue index df3318090..483773cb8 100644 --- a/src/uni_modules/wot-design-uni/components/wd-table/wd-table.vue +++ b/src/uni_modules/wot-design-uni/components/wd-table/wd-table.vue @@ -81,7 +81,7 @@ import { useTranslate } from '../composables/useTranslate' const { translate } = useTranslate('tableCol') const props = defineProps(tableProps) -const emit = defineEmits(['click', 'sort-method', 'row-click']) +const emit = defineEmits(['sort-method', 'row-click']) const reactiveState = reactive({ data: props.data, stripe: props.stripe,