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() } }