vue 動態獲取瀏覽器內容高度並賦值給元素


用到的是vue  style綁定    其中   v-bind=:

以下是代碼

<template>

<div class="hello">

 

  <div  :style="height"></div>

 

</div>

</template>

 

<script>

export default {
name: 'hello',
data () {
  return {
    height:{

      width:'200px',
      height:'',

      backguound:#ccc,

    }
  }
},
components:{
},
created(){
  this.hh()
},
methods:{
  hh(){


    this.height.height=window.innerHeight-153+'px';


  }
}
}

</script>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM