Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions packages/table/src/table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@
v-if="!data || data.length === 0"
class="el-table__empty-block"
ref="emptyBlock"
:style="{
width: bodyWidth
}">
<span class="el-table__empty-text">
:style="emptyBlockStyle">
<span class="el-table__empty-text" >
<slot name="empty">{{ emptyText || t('el.table.emptyText') }}</slot>
</span>
</div>
Expand Down Expand Up @@ -565,6 +563,18 @@
}
},

emptyBlockStyle() {
if (this.data && this.data.length) return null;
let height = '100%';
if (this.layout.appendHeight) {
height = `calc(100% - ${this.layout.appendHeight}px)`;
}
return {
width: this.bodyWidth,
height
};
},

...mapStates({
selection: 'selection',
columns: 'columns',
Expand Down
1 change: 0 additions & 1 deletion packages/theme-chalk/src/table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
min-height: 60px;
text-align: center;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
Expand Down
22 changes: 22 additions & 0 deletions test/unit/specs/table.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1944,6 +1944,28 @@ describe('Table', () => {
}, DELAY);
});

it('table append is visible in viewport if height is 100%', async() => {
const vm = createVue({
template: `
<el-table :data="[]" height="100%">
<el-table-column prop="name" label="片名" />
<el-table-column prop="release" label="发行日期" />
<el-table-column prop="director" label="导演" />
<el-table-column prop="runtime" label="时长(分)" />
<template slot="append">
<div class="append-content" style="height: 48px;">
append 区域始终出现在视图内
</div>
</template>
</el-table>
`
}, true);
await waitImmediate();
const emptyBlockEl = vm.$el.querySelector('.el-table__empty-block');
expect(emptyBlockEl.style.height).to.be.equal('calc(100% - 48px)');
destroyVM(vm);
});

describe('tree', () => {
let vm;
afterEach(() => destroyVM(vm));
Expand Down