给你来个传送门的demo:vue-template
//store 里的缓存
const clientHeight = document.documentElement.clientHeight - 105;
//单页面的引用
clientHeight() {
return this.$store.state.clientHeight - 115;
}
//el-table的属性
:max-height="clientHeight"
监听浏览器窗口高度变化
mounted() {
const that = this;
window.onresize = function temp() {
that.$store.commit(
"setHeight",
document.documentElement.clientHeight - 105
);
};
}