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
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3