<div class="btnBox" v-show="isOriginHei">
<div class="btn" >提交</div>
</div>
vue项目项目中在mountd里面获取视图的高度
mounted() {
const that = this
window.onresize = () => {
return (() => {
window.screenHeight= document.body.clientHeight
that.screenHeight= window.screenHeight
})()
}
},
watch: {
screenHeight(val) {
this.screenHeight= val
if(this.originHeight != val) {
this.isOriginHei = false;
}else{
this.isOriginHei = true;
}
},
}