Vue获取元素高度

vue获取元素的高度主要是利用vue的ref属性


获取高度值:

const height = this.$refs.picWrapper.offsetHeight;

获取元素样式值:

const height = window.getComputedStyle(this.$refs.picWrapper).height;

获取元素内联样式值:

const height =this.$refs.picWrapper.style.height;

你可能感兴趣的:(vue)