1.在data中设置:
tableHeight:"500",
screenHeight:window.innerHeight,
2.在mounted中设置:
mounted() {
const that = this
window.onresize =() =>{
return (()=>{
window.screenHeight = window.innerHeight
this.screenHeight = window.screenHeight;
})()
}
},
3.在watch中监听:
watch:{
screenHeight(val){
this.screenHeight = val
this.tableHeight = this.screenHeight - 250
}
},