Vue中div高度自适应

<template>

  <div :style="conheight">
</template>
<script>
  export default{
    data(){
      conheight:{
                height:''
            }
    },
    methods:{
        getHeight(){
          this.conheight.height=window.innerHeight-170+'px';
       },
    created(){
        window.addEventListener('resize'this.getHeight);
        this.getHeight()
     }
  }
 
</script>
 
posted @ 2020-08-08 10:44  webapp1  阅读(1064)  评论(0编辑  收藏  举报