Эх сурвалжийг харах

MessageBox: wrap hashchange listener in nextTick (#11200)

hetech 7 жил өмнө
parent
commit
b79a98c7e0

+ 5 - 3
packages/message-box/src/main.vue

@@ -273,9 +273,11 @@
     },
 
     mounted() {
-      if (this.closeOnHashChange) {
-        window.addEventListener('hashchange', this.close);
-      }
+      this.$nextTick(() => {
+        if (this.closeOnHashChange) {
+          window.addEventListener('hashchange', this.close);
+        }
+      });
     },
 
     beforeDestroy() {