Vue组件置底方法,ElementPlus布局

问题描述

在开发网页时使用了elementplus的el-container组件

组件里分成了main和footer两块,但是想要将两个按钮置底在容器底部遇到了困难

如下图所示,在网页开发者工具可见两个按钮与左侧的图片没有底部对齐

此时我的代码是这样

javascript 复制代码
<el-footer>
   <el-row :gutter="20" style="  display: flex;justify-content: space-between;">
      <el-space>
        <el-col :span="6">
            <el-button @click="button1function" type="primary">button1</el-button>
        </el-col>
        <el-col :span="6">
            <el-button @click="button2function" type="primary">button2</el-button>
        </el-col>
      </el-space>
   </el-row> 
</el-footer>

解决办法

javascript 复制代码
<el-footer class="align-bottom">
   <el-row :gutter="20" style="  display: flex;justify-content: space-between;">
      <el-space>
        <el-col :span="6">
            <el-button @click="button1function" type="primary">button1</el-button>
        </el-col>
        <el-col :span="6">
            <el-button @click="button2function" type="primary">button2</el-button>
        </el-col>
      </el-space>
   </el-row> 
</el-footer>


//在<style>里加入以下代码
.align-bottom {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

解决效果

相关推荐
范小饭31 分钟前
哼,要变天了:副业赚18块的自救实录
前端
天蓝色的鱼鱼2 小时前
从“死了么”到“我在”:用uniCloud开发一款温暖人心的App
前端·uni-app
小徐_23332 小时前
uni-app 组件库 Wot UI 的 AI 友好型编程指南
前端·uni-app
HelloReader2 小时前
Flutter Widget 基础手把手教你创建自定义组件(二)
前端
Hilaku2 小时前
在 HTTP/3 普及的 2026 年,那些基于 Webpack 的性能优化经验,有一半该扔了
前端·javascript·面试
前端付豪2 小时前
AI 数学辅导老师项目构想和初始化
前端·后端·python
HelloReader2 小时前
从零创建你的第一个 Flutter 应用(一)
前端
程序员阿峰2 小时前
别再写JS监听滚动了!一行CSS搞定导航固定+通讯录效果(附3个案例)
前端
进击的尘埃2 小时前
基于 LLM Function Calling 的前端动态表单生成引擎:从 JSON Schema 映射到运行时组件树的端到端实现
javascript
wordbaby2 小时前
前端进阶:小程序 Canvas 2D 终极指北 — 给图片优雅添加水印
前端·canvas