I am struggling to find a way to bind my screen height to a calculated value in my code. Unfortunately, the current implementation is not working as expected. I would greatly appreciate any guidance on how to resolve this issue.
<template>
<b-container id="notfound-container">
<b-row align-v="center" v-bind:style="{ height : h + 'px' }">
<b-col style="align-items:center">
<h1>404 Error</h1>
<p>The page you have requested does not exist.</p>
</b-col>
</b-row>
</b-container>
</template>
<script>
export default {
name: 'tHome',
data () {
return {
h: (window.innerHeight - document.getElementById('notfound-container').getBoundingClientRect().top)
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
font-weight: normal;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
While the value doesn't necessarily need to be updated dynamically, I do require it to be calculated at least once. At the moment, I am encountering an error stating that "h" has not been initialized.