首发于我的博客 (http://zhengxiyun.top)
mounted(){ window.onresize = () => { return (() => { this.divHeight = window.innerHeight - yourHeight })(); } }, beforeMount() { this.divHeight = window.innerHeight - yourHeight }, data() { return { divHeight: 0 } }