Vue中尽量不使用dom的高度计算
<template> <div :style="conheight"> </template> <script> export default{ data(){ conheight:{ height:'' } }, methods:{ getHeight(){ this.conheight.height=window.innerHeight-170+'px'; }, created(){ window.addEventListener('resize', this.getHeight); this.getHeight() } } </script>