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