js设置高度获取高度

 <div ref="content">
  <div ref="header"></div>
  <div class="tabs_panel" :style="{height: `${billingHeight}px`}" style="overflow: auto"  :class="[isEdit?'class1':'class2']"></div>
</div>
//document.body.clientHeight浏览器高度
//document.body.clientWidth浏览器宽度
//this.$refs.content.offsetHeight//DOM元素高度
   mounted() {
            this.billingHeight = this.$refs.content.$el.offsetHeight - this.$refs.header.offsetHeight
        },
 
 
 
import Bus from '@/libs/bus.js'
 window.onresize = () => {
      return (() => {
        this.setScreenHeight(document.body.clientHeight) //获取浏览器高度
        this.setScreenWidth(document.body.clientWidth)//获取浏览器宽度
        Bus.$emit('getTableHeight')
      })()
    }
原文地址:https://www.cnblogs.com/wssdx/p/14007154.html