Visual Studio Code中<el-row>和<el-col>实现图中的样式布局
使用vue代码
<template>
<div class="layout">
<el-row :gutter="20">
<el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
<el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
<el-col :span="6">
<el-row>
<div class="grid-content-min bg-purple"></div>
</el-row>
<el-row>
<div class="grid-content-min bg-purple"></div>
</el-row>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
<el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
<el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
</el-row>
</div>
</template>
<script>
import { Row, Col } from "element-ui";
export default {
name: "Main",
components: {
ElRow: Row,
ElCol: Col,
},
data() {
return {};
},
};
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.layout{
width: 900px;
height: 600px;
}
.el-row {
margin-bottom: 20px;
&:last-child {
margin-bottom: 0;
}
}
.el-col {
border-radius: 4px;
}
.bg-purple-dark {
background: #99a9bf;
}
.bg-purple {
background: #d3dce6;
}
.bg-purple-light {
background: #e5e9f2;
}
.grid-content {
border-radius: 4px;
min-height: 200px;
}
.grid-content-min {
border-radius: 4px;
min-height: 90px;
}
.row-bg {
padding: 10px 0;
background-color: #f9fafc;
}
</style>
分割出来的效果如下,图片自己放一下吧
Vue2还是3,嵌入已有项目还是新建
图片链接跟间距自己调一下
<el-row>
<el-col :span="8">
<div><img src=" /"></div>
<div><img src=" /"></div>
</el-col>
<el-col :span="8">
<div><img src=" /"></div>
<div><img src=" /"></div>
</el-col>
<el-col :span="8">
<div><img src=" /"></div>
<div><img src=" /"></div>
<div><img src=" /"></div>
</el-col>
</el-row>
只是要一个简单的页面吗