<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;
}
},
}
原文地址:https://www.cnblogs.com/carrie5/p/10298269.html
时间: 2024-10-12 07:29:51