I can't really explain this in words, but I want to bind my screen height to a calculated value. The code here does not work, so I'd like to know how to make it work.
<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>
The value does not need to be dynamically updated, but I'd like it to be calculated at least once. Currently, I get the error that "h" is not initialized.
notfound-containerdiv or something