1 Star 0 Fork 1.5K

沐瑶 / LearningNotes

forked from 陌溪 / LearningNotes 
Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
README.md 623 Bytes
Copy Edit Web IDE Raw Blame History
陌溪 authored 2020-05-06 16:29 . add blog

前言

因为每个用户不同的电脑屏幕宽高度,造成了Table表格的高度不一致,因此想要动态计算出table的高度,让其能够正常的铺满整个屏幕

代码

完整代码如下:首先计算  窗口的高度 - 搜索框的高度 - 固定数值

  mounted () {
    // 计算搜索框的高度
    var searchBarHeight = window.getComputedStyle(this.$refs.searchBar).height.replace('px', '')
    searchBarHeight = parseInt(searchBarHeight)
    this.tableHeight = window.innerHeight - searchBarHeight - 270
  },

Comment ( 0 )

Sign in for post a comment

1
https://gitee.com/muyao_vip/LearningNotes.git
git@gitee.com:muyao_vip/LearningNotes.git
muyao_vip
LearningNotes
LearningNotes
master

Search

102255 3a0e046c 1850385 102255 7aaa926c 1850385