From 703b3beeeb50bc29e5f2ddcf805be201b66396af Mon Sep 17 00:00:00 2001 From: Yue JIN <40021217+kingyue737@users.noreply.github.com> Date: Mon, 22 Apr 2024 23:30:15 +0800 Subject: [PATCH] fix: correctly emit layout-ready event (#20) --- src/components/grid-layout.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/grid-layout.vue b/src/components/grid-layout.vue index c539a0d..e5174ea 100644 --- a/src/components/grid-layout.vue +++ b/src/components/grid-layout.vue @@ -214,9 +214,9 @@ watch( (newVal, oldVal) => { nextTick(() => { emitter.emit('updateWidth', newVal) - if (oldVal === null) { + if (oldVal === -1) { /* - If oldVal == null is when the width has never been + If oldVal === -1 is when the width has never been set before. That only occurs when mounting is finished, and onWindowResize has been called and this.width has been changed the first time after it