html
<template>
<div :style="{height: this.winHeight + 'px'}">
<div :style="{height: this.winHeight * 0.3 + 'px'}"></div>
<div :style="{height: this.winHeight * 0.3 + 'px'}"></div>
<div>底部的 div 会自适应高度</div>
</div>
</template>
<script>
export default {
data () {
return {
winHeight: 0,
}
}
created() {
this.getHeight()
},
methods: {
getHeight () {
const winHeight = window.innerHeight
// this.winHeight = winHeight - tabs 高度 这段可选
console.log('winHeight', this.winHeight)
},
}
};
</script>