Skip to content

Commit 2969ce5

Browse files
committed
Update readme, fixed renderTableRows error
1 parent aa8f7a5 commit 2969ce5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111

1212
## Interfaces
13+
> 并未使用 TypeScript 编写,仅用以表示类型方便所以使用了 TypeScript 的 interface。
14+
1315
```ts
1416
interface ColumnConfig { /* 列配置 */
1517
label?: string;
@@ -76,15 +78,13 @@ props 大部分与 element-ui 的 table 类似。有几点不同:
7678
#### Columns
7779
用于映射列表中的数据。
7880

79-
> 并未使用 TypeScript 编写,仅用以表示类型方便所以使用了 TypeScript 的 interface。
80-
8181
- 需手动编写 `columns` `Array<ColumnConfig>`,ColumnConfig 数据结构描述如下:
8282

8383
| 字段名称 | 字段类型 | 必传 | 默认值 | description |
8484
| --------------------- | :------- | :----- | :---------- | :----- |
8585
| label | string | true | - | 当前列表头显示内容 |
8686
| prop | string | true | - | 当前列 server model 字段的 key |
87-
| key | string | number | - | 当前列 virtual-dom(v-for) 的 key |
87+
| key | string \| number | - | 当前列 virtual-dom(v-for) 的 key |
8888
| width | number | false | - | 当前列的宽度 |
8989
| render | function | false | `row[prop]` | 当前列的自定义 render 函数 => render(h, { depth: Number, expandDepth: Number, row: Row, rowIndex: Number, column: Column, columnIndex: Number, store: TableStore }) |
9090
| filter **暂未实现** | function | false | - | 当前列的 filter 函数 => filter(...args) |

src/components/TableTree/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const TableTree = {
66
props: {
77
// ...ElTable.props,
88
className: [String, Object],
9-
style: {
9+
styleStr: {
1010
type: String,
1111
default: "width: 100%"
1212
},
@@ -132,7 +132,7 @@ const TableTree = {
132132
} = this;
133133

134134
return (
135-
<div class={["table-tree", this.className]} style={this.style}>
135+
<div class={["table-tree", this.className]} style={this.styleStr}>
136136
{header}
137137
<table
138138
width={this.width}
@@ -202,7 +202,7 @@ const TableTree = {
202202
renderTableRows(tableData, depth = 0) {
203203
const { rowKey = "", rowClassName } = this;
204204

205-
return tableData.map((row, index) => {
205+
return tableData && tableData.length && tableData.map((row, index) => {
206206
let rowClass = rowClassName
207207
if (typeof rowClassName === 'function') rowClass = rowClassName(row, index)
208208

0 commit comments

Comments
 (0)