被 Element UI 的 Table 的滚动条折腾了半天

分类:HTML&CSS     发布时间:2026-09-20     最后更新:2026-09-20     浏览数:23
被 Element UI 的 Table 的滚动条折腾了半天

被 Element UI 的 Table 的滚动条折腾了半天。

现象:刷新整个页面后,滚动条不会出现。

问题的原因:有一列是图片,图片加载完后会撑高了 el-table,但是 el-table 没有重绘,所以滚动条不会出现。

解决的方法很简单:给图片固定的高度:40px,宽度自适应。


<div class="page">
    <div class="page__header"></div>
    <div class="page_body">
        <el-column>
            <template slot-scope="scope">
                <el-image class="page__cover" :src="scope.row.cover" />
            </template>
        </el-column>
    </div>
    <el-pagination class="page_footer" />
</div>

<style scoped lang="scss">
.page {
    display: flex;
    flex-direction: column;

    &__header {
        margin-bottom: 20px;
    }

    &__body {
        flex: 1 1 0;
    }

   &__cover {
      height: 40px;
      aspect-ratio: 364 / 426;
   }
}
</style>
上一篇: Windows 系统 Rust 的嵌入式开发环境搭建之 probe-rs 版 下一篇: 没有了