• 博客园Logo
  • 首页
  • 新闻
  • 博问
  • 专区
  • 闪存
  • 班级
  • 我的博客 短消息
    用户头像
    我的博客 我的园子 账号设置 退出登录
    注册 登录
壮哉我大狮子
博客园    首页    新随笔    联系   管理    订阅  订阅

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>

posted @ 2018-01-25 16:14  壮哉我大狮子  阅读(24936)  评论(1)  编辑  收藏
刷新评论刷新页面返回顶部
Copyright © 2021 壮哉我大狮子
Powered by .NET 5.0 on Kubernetes