以表格高度为例
data() {
return {
tableHeight:0
}
}
created() {
this.setClient();
},
methods: {
//表格高度适应可见区域大小
setClient() {
this.changeClient()
window.onresize = () => {
this.changeClient()
}
},
changeClient() {
if(document.body.offsetHeight > 800) {
this.tableHeight = document.body.clientHeight - 240;
}
this.tableHeight = document.body.clientHeight - 290;
},
}