1.在data中设置:
1 tableHeight:"500",2 screenHeight:window.innerHeight,
2.在mounted中设置:
1 mounted() {2 const that = this3 window.onresize =() =>{4 return (()=>{5 window.screenHeight = window.innerHeight6 this.screenHeight = window.screenHeight;7 })()8 }9 },
3.在watch中监听:
1 watch:{2 screenHeight(val){3 this.screenHeight = val4 this.tableHeight = this.screenHeight - 2505 }6 },