Element-Ui组件(一)页面布局
Element-Ui组件(一)页面布局
常用布局 el-row与el-col可搭配实现24格栅格布局,若布局较复杂,可以嵌套使用。 el-container作为布局容器(可以嵌套使用),内部可包含el-header(顶栏),el-aside(侧边栏),el-main(内容),el-footer(底栏)。 页面效果 示例代码
<template>
<el-container>
<!-- 顶栏 -->
<el-header height="60px">
<h2>Element 页面布局</h2>
</el-header>
<!-- 嵌套容器 -->
<el-container>
<!-- 侧边导航菜单 -->
<el-aside width="150px"></el-aside>
<!-- 内容 -->
<el-main>
<!-- 第一列栅格布局 -->
<el-row>
<el-col :span="12" class="col1"></el-col>
<el-col :span="12" class="col2"></el-col>
</el-row>
<!-- 第二列布局 -->
<el-row>
<el-col :span="24" class="col3"></el-col>
</el-row>
</el-main>
</el-container>
<!-- 底栏 -->
<el-footer height="30px">©究极死胖兽 2019</el-footer>
</el-container>
</template>
<script>
export default {
}
</script>
<style>
.el-header {
background-color: #409EFF;
color: white;
}
.el-footer {
background-color: #909399;
color: black;
text-align: center;
}
.el-aside {
background-color: chartreuse;
}
.el-main {
background-color: darkkhaki;
}
.el-col {
height: 200px;
}
.col1 {
background-color: teal;
}
.col2 {
background-color: tomato;
}
.col3 {
background-color: thistle;
}
</style>
el-row 属性:
el-col 属性:
el-container属性:
el-header属性:
el-aside 属性:
el-footer属性:
