From 24b7be6b3299bbe864de01911033476a46f646ff Mon Sep 17 00:00:00 2001 From: aixianling Date: Wed, 25 Oct 2023 10:54:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=87=AA=E9=80=82=E5=BA=94?= =?UTF-8?q?=E7=9A=84=E8=BF=94=E5=9B=9E=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/packages/layout/AiFitView.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ui/packages/layout/AiFitView.vue b/ui/packages/layout/AiFitView.vue index 9559bbd8..8c0f2cab 100644 --- a/ui/packages/layout/AiFitView.vue +++ b/ui/packages/layout/AiFitView.vue @@ -15,7 +15,8 @@ export default { height: 1080 }, width: 0, - height: 0 + height: 0, + observer: null } }, computed: { @@ -37,7 +38,11 @@ export default { }, mounted() { this.$nextTick(this.initSize) - window.onresize = () => this.$nextTick(this.initSize) + this.observer = new ResizeObserver(this.initSize) + this.observer.observe(this.$el) + }, + beforeDestroy() { + this.observer?.disconnect() } }