<template>
<div class="indexbg" :style="{ height: height + 'px' }">
<img src="/static/images/indexbg.png" alt />
</div>
</template>
<script>
export default {
data() {
return {
height: 0
};
},
created() {
this.height = window.screen.height;
console.log(this.height);
}
};
</script>
<style scoped>
.indexbg {
position: relative;
text-align: center;
}
.indexbg img {
width: 65%;
margin: 0 auto; /*水平居中*/
position: relative;
top: 25%; /*偏移*/
transform: translateY(-25%);
}
</style>