data() {
return {
wxShow:true,
domHeight: document.documentElement.clientHeight, //默认屏幕高度
showHeight: document.documentElement.clientHeight, //实时屏幕高度
};
},
mounted(){
window.onresize = () => {
return (() => {
this.showHeight = document.documentElement.clientHeight;//这里需要注意一下可视区高度。
})();
};
},
watch:{
showHeight() {
if (this.domHeight > this.showHeight) {
this.wxShow = false;
} else {
this.wxShow = true;
}
}
},