安装
npm install element-resize-detector
使用
- 在需要的页面引入
import elementResizeDetectorMaker from 'element-resize-detector'
mounted() {
const that = this
const erd = elementResizeDetectorMaker()
//isEcharts 是需要监听的div
erd.listenTo(document.getElementById('isEcharts'), element => {
that.$nextTick(() => {
//写逻辑
})
})
},