vue中如何动态设置元素的高度

1. 添加样式绑定

<div class="container" :style="{height: scrollerHeight}">
</div>

2. 添加属性计算

computed: {
    // 滚动区高度 
    scrollerHeight: function() {
          return (window.innerHeight - 50) + 'px'; //自定义高度需求
    }
}
原文地址:https://www.cnblogs.com/henuyuxiang/p/14991372.html