天天看点

【elementUi】el-table设置高度之后合计行不显示解决方法

问题:

Element 的

el-table

组件在同时设置了表格的高度

height

以及合计行

show-summary

,这导致合计行无法正常显示。

解决方法:

根据文档提供的方法,添加

updated

生命周期,对Table重新布局后得到解决
【elementUi】el-table设置高度之后合计行不显示解决方法
<template>
	<el-table
		ref="table"
		:height="500"
		:data="dataSource"
		show-summary
	/>
</template>

<script>
export default {
	data() {
		return {
			dataSource: []
		}
	},
	updated() {
		this.$nextTick(() => {
			this.$refs.table.doLayout()
		})
	}
	
}
</script>