To get the current window height of your browser as it changes, use this script:
new Vue({
el: '#app',
data() {
return {
windowHeight: window.innerHeight
}
},
mounted() {
this.$nextTick(() => {
window.addEventListener('resize', this.onResize);
})
},
beforeDestroy() {
window.removeEventListener('resize', this.onResize);
},
methods: {
onResize() {
this.windowHeight = window.innerHeight
}
}
});
How to display the information:
<div id="app">
Current height: {{ windowHeight }}
</div>