• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
壮哉我大狮子
博客园    首页    新随笔    联系   管理    订阅  订阅

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  壮哉我大狮子  阅读(29386)  评论(1)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3