mirror of https://github.com/ElemeFE/element
Table: extend height prop usage (#9575)
parent
f274f3e3d9
commit
ab2f3830d6
|
@ -1948,7 +1948,7 @@ You can customize row index in `type=index` columns.
|
||||||
| Attribute | Description | Type | Accepted Values | Default |
|
| Attribute | Description | Type | Accepted Values | Default |
|
||||||
|---------- |-------------- |---------- |-------------------------------- |-------- |
|
|---------- |-------------- |---------- |-------------------------------- |-------- |
|
||||||
| data | Table data | array | — | — |
|
| 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 | — | — |
|
| 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 |
|
| stripe | whether Table is striped | boolean | — | false |
|
||||||
| border | whether Table has vertical border | boolean | — | false |
|
| border | whether Table has vertical border | boolean | — | false |
|
||||||
|
|
|
@ -2008,7 +2008,7 @@
|
||||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||||
|---------- |-------------- |---------- |-------------------------------- |-------- |
|
|---------- |-------------- |---------- |-------------------------------- |-------- |
|
||||||
| data | 显示的数据 | array | — | — |
|
| 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 | — | — |
|
| max-height | Table 的最大高度 | string/number | — | — |
|
||||||
| stripe | 是否为斑马纹 table | boolean | — | false |
|
| stripe | 是否为斑马纹 table | boolean | — | false |
|
||||||
| border | 是否带有纵向边框 | boolean | — | false |
|
| border | 是否带有纵向边框 | boolean | — | false |
|
||||||
|
|
|
@ -63,9 +63,7 @@ class TableLayout {
|
||||||
|
|
||||||
this.updateElsHeight();
|
this.updateElsHeight();
|
||||||
} else if (typeof value === 'string') {
|
} else if (typeof value === 'string') {
|
||||||
if (value === '') {
|
el.style[prop] = value;
|
||||||
el.style[prop] = '';
|
|
||||||
}
|
|
||||||
this.updateElsHeight();
|
this.updateElsHeight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,15 @@ describe('Table', () => {
|
||||||
}, DELAY);
|
}, 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 => {
|
it('maxHeight', done => {
|
||||||
const vm = createTable('max-height="134"');
|
const vm = createTable('max-height="134"');
|
||||||
setTimeout(_ => {
|
setTimeout(_ => {
|
||||||
|
|
Loading…
Reference in New Issue