diff --git a/docs/component/table.md b/docs/component/table.md index c502bda6..fbc943da 100644 --- a/docs/component/table.md +++ b/docs/component/table.md @@ -4,7 +4,6 @@ 用于展示多条结构类似的数据, 可对数据进行排序等操作。 - ## 基础用法 通过`data`设置表格数据。 @@ -19,21 +18,21 @@ ```ts const dataList = reactive([ -{ - name: '赵云', - school: '武汉市阳逻妇幼保健学院', - major: '计算机科学与技术专业' -}, -{ - name: '孔明', - school: '武汉市阳逻卧龙学院', - major: '计算机科学与技术专业' -}, -{ - name: '刘备', - school: '武汉市阳逻编织学院', - major: '计算机科学与技术专业' -} + { + name: '赵云', + school: '武汉市阳逻妇幼保健学院', + major: '计算机科学与技术专业' + }, + { + name: '孔明', + school: '武汉市阳逻卧龙学院', + major: '计算机科学与技术专业' + }, + { + name: '刘备', + school: '武汉市阳逻编织学院', + major: '计算机科学与技术专业' + } ]) ``` @@ -76,8 +75,6 @@ const dataList = reactive([ ``` - - ## 表格高度 通过`height`设置表格高度,默认为`80vh`。 @@ -111,7 +108,7 @@ function handleSort(e) { ## 自定义列模板 自定义列的显示内容,可组合其他组件使用。 -通过 `Scoped slot` 可以获取到 `row` 的数据,用法参考 demo。 +通过 `Scoped slot` 可以获取到 `row`, `index` 的数据,用法参考 demo。 ```html @@ -216,29 +213,32 @@ function handleSort(e) { align-items: center; } ``` + ## 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 | - - - +| 参数 | 说明 | 类型 | 可选值 | 默认值 | 最低版本 | +| ---------- | -------------------------- | ----------------- | ------ | ------ | -------- | +| 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 | ## TableColumn Attributes -| 参数 | 说明 | 类型 | 可选值 | 默认值 | 最低版本 | -| --------- | ----------- | ---------------------- | ------------------------------------------------ | -------- | --------- | -| prop | 字段名称,对应列内容的字段名| string | - | - | 0.0.39 | -| label | 显示的标题 | string | - | - | 0.0.39 | -| width | 对应列的宽度,单位为px | number / string | - | 100 | 0.0.39 | -| sortable | 是否开启列排序 | boolean | - | false | 0.0.39 | -| fixed | 是否固定本列 | boolean | - | false | 0.0.39 | -| align | 列的对齐方式 | AlignType | left, center, right | left | 0.0.39 | +| 参数 | 说明 | 类型 | 可选值 | 默认值 | 最低版本 | +| -------- | --------------------------- | --------------- | ------------------- | ------ | -------- | +| prop | 字段名称,对应列内容的字段名 | string | - | - | 0.0.39 | +| label | 显示的标题 | string | - | - | 0.0.39 | +| width | 对应列的宽度,单位为 px | number / string | - | 100 | 0.0.39 | +| sortable | 是否开启列排序 | boolean | - | false | 0.0.39 | +| fixed | 是否固定本列 | boolean | - | false | 0.0.39 | +| align | 列的对齐方式 | AlignType | left, center, right | left | 0.0.39 | + +## TableColumn Slot + +| name | 说明 | 参数 | 最低版本 | +| ----- | -------------------------------------- | -------------------------------- | -------- | +| value | 自定义列的内容,1.2.16 新增`index`参数 | `{ row: Object, index: number }` | 0.1.22 | diff --git a/src/uni_modules/wot-design-uni/components/wd-sidebar-item/wd-sidebar-item.vue b/src/uni_modules/wot-design-uni/components/wd-sidebar-item/wd-sidebar-item.vue index 8347bb7b..ab427c40 100644 --- a/src/uni_modules/wot-design-uni/components/wd-sidebar-item/wd-sidebar-item.vue +++ b/src/uni_modules/wot-design-uni/components/wd-sidebar-item/wd-sidebar-item.vue @@ -92,4 +92,3 @@ function handleClick() { -../wd-sidebar/type diff --git a/src/uni_modules/wot-design-uni/components/wd-step/wd-step.vue b/src/uni_modules/wot-design-uni/components/wd-step/wd-step.vue index 7703c8ff..24a5ddce 100644 --- a/src/uni_modules/wot-design-uni/components/wd-step/wd-step.vue +++ b/src/uni_modules/wot-design-uni/components/wd-step/wd-step.vue @@ -147,4 +147,3 @@ function getCurrentTitle(currentStatus: string) { -../wd-steps/type diff --git a/src/uni_modules/wot-design-uni/components/wd-tab/wd-tab.vue b/src/uni_modules/wot-design-uni/components/wd-tab/wd-tab.vue index f1535b2c..1f9b45b7 100644 --- a/src/uni_modules/wot-design-uni/components/wd-tab/wd-tab.vue +++ b/src/uni_modules/wot-design-uni/components/wd-tab/wd-tab.vue @@ -99,4 +99,3 @@ defineExpose({ -../wd-tabs/type diff --git a/src/uni_modules/wot-design-uni/components/wd-tabbar-item/wd-tabbar-item.vue b/src/uni_modules/wot-design-uni/components/wd-tabbar-item/wd-tabbar-item.vue index 9dee01d6..fca394cf 100644 --- a/src/uni_modules/wot-design-uni/components/wd-tabbar-item/wd-tabbar-item.vue +++ b/src/uni_modules/wot-design-uni/components/wd-tabbar-item/wd-tabbar-item.vue @@ -72,4 +72,3 @@ function handleClick() { -../wd-tabbar/type diff --git a/src/uni_modules/wot-design-uni/components/wd-tabbar/wd-tabbar.vue b/src/uni_modules/wot-design-uni/components/wd-tabbar/wd-tabbar.vue index 48f9bdce..1b82fac2 100644 --- a/src/uni_modules/wot-design-uni/components/wd-tabbar/wd-tabbar.vue +++ b/src/uni_modules/wot-design-uni/components/wd-tabbar/wd-tabbar.vue @@ -89,4 +89,3 @@ function setPlaceholderHeight() { -../wd-tabbar-item/type./type diff --git a/src/uni_modules/wot-design-uni/components/wd-table-col/wd-table-col.vue b/src/uni_modules/wot-design-uni/components/wd-table-col/wd-table-col.vue index bd150cc6..e0219e17 100644 --- a/src/uni_modules/wot-design-uni/components/wd-table-col/wd-table-col.vue +++ b/src/uni_modules/wot-design-uni/components/wd-table-col/wd-table-col.vue @@ -10,7 +10,7 @@ :style="cellStyle" @click="handleRowClick(index)" > - + {{ row }} 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 4085ee14..8fbf43f1 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 @@ -251,4 +251,3 @@ function setRowClick(index: number) { -../wd-table-col/type