1.安装element-resize-detector
npm install element-resize-detector --save
2.引用
let elementResizeDetectorMaker = require("element-resize-detector")
3.使用
resizeFun (data) {
let _this = this;
let erd = elementResizeDetectorMaker()
erd.listenTo(document.getElementById(data), function (element) {
_this.$nextTick(function () {
if (_this.valueone1 != undefined) {
_this[`${data}`].resize();
}
})
})
}
this.resizeFun("valueone1")
eg: