1 Star 0 Fork 3.1K

沐瑶 / LearningNotes

forked from 陌溪 / LearningNotes 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 623 Bytes
一键复制 编辑 原始数据 按行查看 历史
陌溪 提交于 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
  },
1
https://gitee.com/muyao_vip/LearningNotes.git
git@gitee.com:muyao_vip/LearningNotes.git
muyao_vip
LearningNotes
LearningNotes
master

搜索帮助