常用的方法:
高度:
document.documentElement.clientHeight
738px
宽度:
document.documentElement.clientWidth
886px
效果图:
不废话,贴代码了:
<template>
<div class="hello">
<div :style="height"></div>
</div>
</template>
<script>
export default {
name: 'hello',
data () {
return {
height:{
width:'200px',
height:'',
background:'red',
}
}
},
components:{
},
created(){
this.hh();
},
methods:{
hh(){
this.height.height = (window.innerHeight)*0.69 + 'px';
console.log("this.height.height",this.height.height);
}
}
}
</script>