1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| export default {
| data() {
| return {
| elementHeight: null,
| contHeight: null
| }
| },
| created() {
| this.getElHeight(0);
| },
| mounted() {
| window.addEventListener('resize', this.getElHeight)
| },
| beforeDestroy() {
| window.removeEventListener('resize', this.getElHeight); // 移除窗口大小变化监听器
| },
| methods: {
| // 设置表格高度
| getElHeight(num) {
| this.$nextTick(() => {
| this.elementHeight =
| this.$refs.contBox.$el.clientHeight -
| this.$refs.headBox.offsetHeight -
| 124 -
| this.$refs.pagination.offsetHeight + num;
| });
| },
| }
| }
|
|