<div id="app">
<div class="box" ref="box"></div>
<button @click="getData">get</button>
</div>
.box{
width: 50%;
height: 200px;
background: pink;
}
let app=new Vue({
el: "#app",
data: {
},
methods: {
getData: function(){
let width=this.$refs.box.clientWidth;
let height=this.$refs.box.clientHeight;
console.log(width+", "+height)
}
}
})
This Pen doesn't use any external CSS resources.