首页 > 其他 > 详细

vue 获取dom元素

时间:2017-11-22 14:58:39      阅读:175      评论:0      收藏:0      [点我收藏+]
<template>
  <div style="display: block;" ref="abc">
    <!-- ... -->
  </div>
</template>

<script>
export default {
  mounted: function () { // 此处不能用beforeMounte
    console.log(this.$refs.abc.style.cssText)
  }
}
</script>

输出结果是 display: block;

this.$refs.abc.getBoundingClientRect().height 获取高度

vue 获取dom元素

原文:http://www.cnblogs.com/handsome-jm/p/7879123.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!