Vue中尽量不使用dom的高度计算

<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>

 

转载于:https://www.cnblogs.com/Kyaya/p/10309148.html

Logo

前往低代码交流专区

更多推荐