el-table设置高度合计行不显示

 问题:设置了表格最大高度之后,到超出最大高度,show-summary(合计行)就无法显示了。

解决办法:添加updated生命周期,对table重新布局。

代码:

<template>
    <el-card>
        <ele-pro-table
            ref="table"
            max-height="600"
            :header-cell-style="{ textAlign: 'center' }"
            :summary-method="getSummaries"
            show-summary
        >
        </ele-pro-table>
    </el-card>
</template>

<script>
    export default {
        data() {
            return {};
        },

        updated() {
            this.$nextTick(() => {
                this.$refs.table.doLayout();
            });
        },
        methods: {
            getSummaries() {}
        }
    };
</script>

<style></style>

参考资料: element -Ui,表格el-table设置高度之后合计行不显示解决方法 - 八月正凉 - 博客园

猜你喜欢

转载自blog.csdn.net/ZWP_990527/article/details/128342583