vue 监听div宽高变化
npm install element-resize-detector --saveimport elementResizeDetectorMaker from "element-resize-detector";mounted() {const _this = this;const erd = elementResizeDetectorMaker();...
·
npm install element-resize-detector --save
import elementResizeDetectorMaker from "element-resize-detector";
mounted() {
const _this = this;
const erd = elementResizeDetectorMaker();
erd.listenTo(document.getElementById("aa"), element => {
_this.$nextTick(() => {
//监听到事件后执行的业务逻辑
});
});
},
说明:
document.getElementById("aa")
表示,监听id为aa的div
更多推荐
已为社区贡献11条内容
所有评论(0)