<template>
<div v-show="isShow">
<slot></slot>
</div>
</template>
<script>
export default {
name: "clientListener",
data() {
return {
clientHeight: document.documentElement.clientHeight,
currentHeight: document.documentElement.clientHeight,
isShow: true,
};
},
mounted() {
window.onresize = () => {
return (() => {
this.currentHeight = document.documentElement.clientHeight;
})();
};
},
watch: {
nowHeight: function () {
if (this.clientHeight > this.currentHeight) {
this.isShow = false;
} else {
this.isShow = true;
}
},
},
};
</script>