1.模擬限制寬高 【在要獲取寬高的元素 上加 ref 屬性】
<div style="width:600px;height:300px" ref="barparent" > </div>
2.獲取寬高
console.log('this.$refs.barparent.$el.offsetWidth', this.$refs.barparent.$el.offsetWidth) //寬度 console.log('this.$refs.barparent.offsetHeight', this.$refs.barparent.$el.offsetHeight) //高度