vue 獲取組件高度
Vue獲取元素高度
// 當前區域
<div ref="element"></div>
// 獲取高度值 (內容高+padding+邊框)
let height= this.$refs.element.offsetHeight; //100
// 獲取元素樣式值 (存在單位)
let height = window.getComputedStyle(this.$refs.element).height; // 100px
// 獲取元素內聯樣式值(非內聯樣式無法獲取)
let height = this.$refs.element.style.height; // 100px
參考自
https://blog.csdn.net/zqian1994/article/details/82732825