<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
<title>Title</title>
<style>
* {
margin: 0;
padding: 0;
}
#app {
display: flex;
flex-direction: row;
height: 100vh;
width: 100vw
}
#header {
flex: none;
background: red;
}
.width200 {
width: 200px;
}
.width80 {
width: 80px;
}
#main {
flex: auto;
}
#footer {
flex: none;
background: red
}
</style>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>
</head>
<body>
<div id="app">
<div id="header" :class="{width80:widthFlag,width200 : !widthFlag}" @click="widthFlag=!widthFlag">
<h1>请点击这里</h1>
</div>
<div id="main">
<div v-for="n in 10">{{n}}</div>
</div>
<div id="footer" class="width80"></div>
</div>
<script>
var app = new Vue({
el: '#app',
data: {
message: 'Hello Vue!',
widthFlag: true
}
})
</script>
</body>
</html>