Table: extend height prop usage (#9575)

pull/9581/head
FuryBean 2018-01-31 13:32:01 +08:00 committed by 杨奕
parent f274f3e3d9
commit ab2f3830d6
4 changed files with 12 additions and 5 deletions

View File

@ -1948,7 +1948,7 @@ You can customize row index in `type=index` columns.
| Attribute | Description | Type | Accepted Values | Default |
|---------- |-------------- |---------- |-------------------------------- |-------- |
| data | Table data | array | — | — |
| height | Table's height. By default it has an `auto` height. If its value is a number, the height is measured in pixels; if its value is a string, the height is affected by external styles | string/number | — | — |
| height | Table's height. By default it has an `auto` height. If its value is a number, the height is measured in pixels; if its value is a string, the value will be assigned to element's style.height, the height is affected by external styles | string/number | — | — |
| max-height | Table's max-height. The height of the table starts from `auto` until it reaches the maxHeight limit. The `maxHeight` is measured in pixels, same as `height` | string/number | — | — |
| stripe | whether Table is striped | boolean | — | false |
| border | whether Table has vertical border | boolean | — | false |

View File

@ -2008,7 +2008,7 @@
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---------- |-------------- |---------- |-------------------------------- |-------- |
| data | 显示的数据 | array | — | — |
| height | Table 的高度,默认为自动高度。如果 height 为 number 类型,单位 px如果 height 为 string 类型,则 Table 的高度受控于外部样式。 | string/number | — | — |
| height | Table 的高度,默认为自动高度。如果 height 为 number 类型,单位 px如果 height 为 string 类型,则这个高度会设置为 Table 的 style.height 的值Table 的高度受控于外部样式。 | string/number | — | — |
| max-height | Table 的最大高度 | string/number | — | — |
| stripe | 是否为斑马纹 table | boolean | — | false |
| border | 是否带有纵向边框 | boolean | — | false |

View File

@ -63,9 +63,7 @@ class TableLayout {
this.updateElsHeight();
} else if (typeof value === 'string') {
if (value === '') {
el.style[prop] = '';
}
el.style[prop] = value;
this.updateElsHeight();
}
}

View File

@ -90,6 +90,15 @@ describe('Table', () => {
}, DELAY);
});
it('height as string', done => {
const vm = createTable('height="100pt"');
setTimeout(_ => {
expect(vm.$el.style.height).to.equal('100pt');
destroyVM(vm);
done();
}, DELAY);
});
it('maxHeight', done => {
const vm = createTable('max-height="134"');
setTimeout(_ => {