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