vue3 element-plus 让el-container占满屏幕

在刚开始用element-plus的布局时,发现无法占满屏幕:

App.vue中添加如下css代码:

css 复制代码
<style>
  html, body, #app {
    margin: 0;
    padding: 0;
    height: 100%;
  }
</style>

同时布局代码所在的component如下所示:

html 复制代码
<template>
  <div class="common-layout">
    <el-container>
      <el-header id="header">Header</el-header>
      <el-main id="main">Main</el-main>
    </el-container>
  </div>
</template>

<script setup lang="ts">
</script>

<style>
  .common-layout, .el-container {
    height: 100%;
  }
</style>

即可保证占满屏幕:

相关推荐
迪巴拉15251 小时前
基于Vue与Spring Boot+Open Cv的智慧校园考勤系统
前端·vue.js·spring boot
&活在当下&1 小时前
Vue3 h函数用法详解
前端·javascript·vue.js
小贵子的博客1 小时前
(vue3错误处理)has naming conflicts with other components, ignored.
前端·javascript·vue.js
跟着珅聪学java3 小时前
Electron 读取 JSON 配置文件教程
前端·javascript·vue.js
钰衡大师4 小时前
Vue 3 源码学习教程
前端·vue.js·学习
日光倾5 小时前
【Vue.js 入门笔记】闭包和对象引用
前端·vue.js·笔记
EstherNi5 小时前
左右两侧定位的效果,vue3
javascript·vue.js
Rsun045515 小时前
Vue相关面试题
前端·javascript·vue.js
左夕6 小时前
深入理解Vue中的插槽:概念、原理与应用
前端·vue.js