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')
      })()
    }


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM