vue监听div宽度高度变化
模块 element-resize-detector
import elementResizeDetectorMaker from ‘element-resize-detector‘
const _this = this
const erd = elementResizeDetectorMaker()
erd.listenTo(document.getElementById("app"),(element)=>{
_this.$nextTick(()=>{
this.$refs.tapp.style.height= element.offsetHeight+‘px‘
})
})
给要改变高度的div添加 ref="tapp"
文章来自:https://www.cnblogs.com/PoisonousMushrooms/p/12206788.html