| | |
| | | * 当浏览器可视窗口尺寸发生改变时触发 |
| | | */ |
| | | handleWindowResize(){ |
| | | const boxHeight = +window.getComputedStyle(document.getElementById('EfficiencyShift')).height.slice(0,-2) |
| | | const tableHeadHeight = +window.getComputedStyle(document.querySelector('.ant-table-thead th')).height.slice(0,-2) |
| | | this.scrollY = boxHeight - tableHeadHeight |
| | | const devicePixelRatio = window.devicePixelRatio // 浏览器缩放比 |
| | | if (devicePixelRatio < 1) return // 缩放比小于1时不进行高度重新设置,因为scrollY变大后表格超出部分会被隐藏导致滚动条不可见 |
| | | const clientHeight = document.body.clientHeight // 浏览器可视区域高度 |
| | | const containerTopToClientTopHeight = document.getElementById('EfficiencyShift').getBoundingClientRect().top // 表格容器顶部到浏览器可视区域顶部的间距 |
| | | const tableHeadHeight = +window.getComputedStyle(document.querySelector('.ant-table-thead th')).height.slice(0, -2) // 表格表头高度 |
| | | this.scrollY = clientHeight - containerTopToClientTopHeight - tableHeadHeight // 表格垂直滚动条高度 |
| | | } |
| | | } |
| | | } |