element-ui 中让el-container 高度自适应

做vue项目。

1、在assets文件夹中,新建一个global.css文件。

html,body,#app {
  height: 100%;
  margin: 0;
  padding: 0;
}

2、然后在main.js中引入 global.css

import '@/assets/css/global.css'

3、后续给你所有的组件设置 height:100% 就可以了。

eg:

 <el-container class="layout-container">
    <el-aside width="300px">
    </el-aside>
 <el-container>
.layout-container {
  height: 100%;
}
posted @ 2020-10-16 14:05  小茴香  阅读(8381)  评论(2编辑  收藏  举报
Live2D