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;
}

解决效果

相关推荐
用户5433081441946 分钟前
AI 时代,前端逆向的门槛已经低到离谱 — 以 Upwork 为例
前端
JarvanMo10 分钟前
Flutter 版本的 material_ui 已经上架 pub.dev 啦!快来抢先体验吧。
前端
JohnYan14 分钟前
工作笔记-CodeBuddy应用探索
javascript·ai编程·aiops
恋猫de小郭37 分钟前
AI 可以让 WIFI 实现监控室内人体位置和姿态,无需摄像头?
前端·人工智能·ai编程
哀木41 分钟前
给自己整一个 claude code,解锁编程新姿势
前端
程序员鱼皮1 小时前
GitHub 关注突破 2w,我总结了 10 个涨星涨粉技巧!
前端·后端·github
UrbanJazzerati1 小时前
Vue3 父子组件通信完全指南
前端·面试
是一碗螺丝粉1 小时前
5分钟上手LangChain.js:用DeepSeek给你的App加上AI能力
前端·人工智能·langchain
wuhen_n1 小时前
双端 Diff 算法详解
前端·javascript·vue.js
UrbanJazzerati1 小时前
Vue 3 纯小白快速入门指南
前端·面试