JSFiddle - React, Tailwind, and code Playground
HTML
<script src="//unpkg.com/vue/dist/vue.js"></script>
<script src="//unpkg.com/element-ui@2.2.0/lib/index.js"></script>
<div id="app">
<el-container>
<el-header>Header</el-header>
<el-container>
<el-aside width="200px">Aside</el-aside>
<el-main>
<div v-for="num in nums" class="mdiv">
{{num}}
</div>
</el-main>
</el-container>
</el-container>
<el-button @click.native="add">添加一个</el-button>
<el-button @click.native="remove">移除一个</el-button>
<!-- 说明 -->
<!-- 当block的数量不断增加之后,el-main会挤压el-aside的空间,即使el-aside的宽度已经确定 -->
<!-- 初步判断是flex-basis=auto的问题 -->
</div>
SCSS
@import url("//unpkg.com/element-ui@2.2.0/lib/theme-chalk/index.css");
.el-header, .el-footer {
background-color: #B3C0D1;
color: #333;
text-align: center;
line-height: 60px;
}
.el-aside {
background-color: #D3DCE6;
color: #333;
text-align: center;
line-height: 200px;
}
.el-main {
background-color: #E9EEF3;
color: #333;
text-align: center;
line-height: 160px;
}
body > .el-container {
margin-bottom: 40px;
}
.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
line-height: 260px;
}
.el-container:nth-child(7) .el-aside {
line-height: 320px;
}
.mdiv {
display: block;
float: left;
width: 100px;
height: 100px;
}
Babel + JSX
var Main = {
data() {
return {
nums: 20,
};
},
methods: {
add: function() {
this.nums ++;
},
remove: function() {
this.nums --;
}
}
};
var Ctor = Vue.extend(Main)
new Ctor().$mount('#app')