1. 添加样式绑定
<div class="container" :style="{height: scrollerHeight}">
</div>
2. 添加属性计算
computed: {
// 滚动区高度
scrollerHeight: function() {
return (window.innerHeight - 50) + 'px'; //自定义高度需求
}
}
<div class="container" :style="{height: scrollerHeight}">
</div>
computed: {
// 滚动区高度
scrollerHeight: function() {
return (window.innerHeight - 50) + 'px'; //自定义高度需求
}
}