通过new ResizeObserver
//el代表的是你最大盒子元素传过来
heig (el) {
let ob = new ResizeObserver(() => {
this.hei = el.offsetHeight - 300 + "px";
});
ob.observe(el);
this.$once("hook:beforeDestroy", () => {
ob.disconnect();
});
},
使用this.heig(this.$refs.box);